如何配置 Xcode 以使用 Maven
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5768465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I configure Xcode to use Maven
提问by Jody Garnett
XCode comes out of the box with support for Ant (with several sample projects you can generate).
XCode 开箱即用,支持 Ant(您可以生成几个示例项目)。
How can I configure XCode to use maven pom.xml files?
如何配置 XCode 以使用 maven pom.xml 文件?
Fore reference the project I am trying to set up is here:
我试图建立的项目的前参考在这里:
It makes use of nested folders, each with their own pom.xml, all controlled with the usual maven build targets of:
它使用嵌套文件夹,每个文件夹都有自己的 pom.xml,所有这些都由通常的 maven 构建目标控制:
- mvn clean install
- mvn install -o
- mvn install -o -DskipTests
- mvn 全新安装
- mvn 安装 -o
- mvn install -o -DskipTests
What makes this a challenge is the nested modules; each of which installs into the local ~/.m2/repository.
使这成为挑战的是嵌套模块;每个都安装到本地 ~/.m2/repository 中。
For comparison: The eclipse build system references jars in the ~/.m2/repository for external dependencies, while still allowing modules in the project to refer to each other.
对比:eclipse构建系统引用~/.m2/repository中的jar包用于外部依赖,同时仍然允许项目中的模块相互引用。
I would like a way to set up something similar for XCode.
我想要一种为 XCode 设置类似内容的方法。
回答by sal
You can use do this:
你可以使用这样做:
mvn ant:ant
to create a full ant build and then use that from xcode. You'll need to re-run that task every time you change the pom. You can add a shell task to do run that as the first step in your build.
创建一个完整的蚂蚁构建,然后从 xcode 使用它。每次更改 pom 时都需要重新运行该任务。您可以添加一个 shell 任务来运行它作为构建的第一步。
You could also try to turn the $M2_HOME/bin/mvn
into a shell task in the build. That might work but you'll never be able to debug issues with it without lots of black magic.
您也可以尝试$M2_HOME/bin/mvn
在构建中将其转换为 shell 任务。这可能有效,但如果没有大量黑魔法,您将永远无法使用它来调试问题。
I would try the prior before the later.
我会先尝试之前的。
回答by Chanuka Ranaba
You could use Xcode Maven Pluginto use maven in your Xcode.
您可以使用Xcode Maven Plugin在您的 Xcode 中使用 maven。
thisis the git hub repository.
这是 git hub 存储库。
The following prerequisites have to be fulfilled in order to use the Xcode Maven plugin:
必须满足以下先决条件才能使用 Xcode Maven 插件:
- Mac OS X >= 10.7(Lion)+ The build has to run on a Mac computer.
- JRE 6+ The Java runtime environment has to be installed on the computer.
- Maven >= 3.0.2 Maven 3 has to be installed and configured correctly so that is has access to central repositories.
- Xcode >= 4.4 Xcode 4.4 or higher has to be installed as the plugin performs
- Xcode command line calls.
- Mac OS X >= 10.7(Lion)+ 构建必须在 Mac 计算机上运行。
- JRE 6+ 必须在计算机上安装 Java 运行时环境。
- Maven >= 3.0.2 Maven 3 必须正确安装和配置,以便可以访问中央存储库。
- Xcode >= 4.4 插件运行时必须安装 Xcode 4.4 或更高版本
- Xcode 命令行调用。
回答by kfox
I noticed that there are no answers to this question posted. If it is not possible, then maybe you can just have maven call an ant target to build the xcode?
我注意到发布的这个问题没有答案。如果不可能,那么也许您可以让 maven 调用一个 ant 目标来构建 xcode?