I've been doing some research on adding Maven to an existing Android project and I'm struggling to see how this works. I've used Maven once at work on a web based project with Netbeans, but for this project I'm looking to use IntelliJ. I can create a new "Maven Module", but I already have an Android project so I'm not entirely sure that's the route I should be taking.

我一直在研究如何将Maven添加到现有的Android项目中,我很难看到它是如何工作的。我曾经在Netbeans的网络项目中使用过Maven,但是对于这个项目,我希望使用IntelliJ。我可以创建一个新的“Maven模块”,但我已经有了一个Android项目,所以我不完全确定这是我应该采取的路线。

I found this post which does provide some detail, but not a step-by-step windows integration guide (at least that I'm seeing).

我发现这篇文章确实提供了一些细节,但不是一步一步的Windows集成指南(至少我看到了)。

Is it possible for me to use Maven within an Android project?

我可以在Android项目中使用Maven吗?

Edit: I'm looking to do this within a Windows environment

编辑:我希望在Windows环境中执行此操作

1 个解决方案

#1


7

To answer your question in the last sentence: Yes, you can use Maven to build an Android project.

在最后一句中回答你的问题:是的,你可以使用Maven来构建一个Android项目。

You should use the maven-android-plugin in your Maven project. The best place to get started is https://code.google.com/p/maven-android-plugin/wiki/GettingStarted. Need to read up a bit, but definitely worth the effort.

你应该在你的Maven项目中使用maven-android-plugin。入门的最佳位置是https://code.google.com/p/maven-android-plugin/wiki/GettingStarted。需要阅读一下,但绝对值得付出努力。

If I have existing IDE specific Android project that you would like to switch to Maven, instead of trying to "add Maven support to an existing IntelliJ project", I would:

如果我想要切换到Maven的现有IDE特定的Android项目,而不是尝试“将Maven支持添加到现有的IntelliJ项目”,我会:

  1. Create a new Maven based project using an appropriate archetype https://github.com/akquinet/android-archetypes

    使用适当的原型创建一个新的基于Maven的项目https://github.com/akquinet/android-archetypes

  2. Copy existing source/resources to the Maven project directories.

    将现有源/资源复制到Maven项目目录。

If done correctly, you can open this (Android) Maven project (pom.xml) in IntelliJ and use it like an Android project (including GUI editor). IntelliJ automatically generates an IntelliJ project from Maven's pom.xml and detects the Android facet.

如果操作正确,您可以在IntelliJ中打开此(Android)Maven项目(pom.xml)并将其用作Android项目(包括GUI编辑器)。 IntelliJ自动从Maven的pom.xml生成IntelliJ项目并检测Android facet。

This way, your project also stays IDE agnostic - you can do everything (build/test/deploy) from command line as well - how Maven projects should be IMHO. :D

这样,您的项目也保持IDE不可知 - 您也可以从命令行执行所有操作(构建/测试/部署) - Maven项目应该如何恕我直言。 :d

更多相关文章

  1. Thrift项目Server端开发流程
  2. [java混淆器问题] 如何让web项目的class文件不能被反编译,又能在w
  3. java socket项目打包成可运行的JAR包!!!!!
  4. 阿里云服务器上部署java项目(安装jdk,tomcat)
  5. JAVASCRIPT实现翻页保存已勾选的项目
  6. Blue Pelican Java项目“Masking Telemetry Data”;编译但没有运
  7. java项目中Classpath路径到底指的是哪里?
  8. javascript 操作流——回调的回调
  9. Java项目中的classpath

随机推荐

  1. 超级好用的RabbitMQ 消息 100% 投递的解
  2. 入土系列 | 前端入门实战项目(四)
  3. 吊打面试官系列 | ES6 面试知识点精华篇(
  4. 动画:什么是堆?
  5. 动画:用动画给面试官解释 KMP 算法
  6. 保姆级教学:手把手教你如何实现同期群分析
  7. 考研成绩出了,你考的怎么样?
  8. 这篇博士毕业论文致谢句句诛心......
  9. 我太难了,太难了!!!
  10. 动画:如何用「前端」做出吊炸天基于大数据