Gradle setupBuild不转换maven pom.xml文件

时间:2014-03-28 20:51:29

标签: java maven gradle

我有一个我想要转换的maven项目,以便使用Gradle构建它。似乎gradle没有检测到pom.xml文件,但是:

$ gradle -v

------------------------------------------------------------
Gradle 1.11
------------------------------------------------------------

Build time:   2014-02-11 11:34:39 UTC
Build number: none
Revision:     a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:          2.2.0
JVM:          1.7.0_45 (Oracle Corporation 24.45-b08)
OS:           Windows 7 6.1 amd64

$ ls
pom.xml  src  target


$ gradle setupBuild --info
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using empty build file.
Included projects: [root project 'simple-service-webapp']
Evaluating root project 'simple-service-webapp' using empty build file.
All projects evaluated.

FAILURE: Build failed with an exception.

* What went wrong:
Task 'setupBuild' not found in root project 'simple-service-webapp'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 1.589 secs

1 个答案:

答案 0 :(得分:4)

Gradle没有读取pom.xml文件来构建项目。但它完成了pom通常描述的所有相同的事情。在gradle脚本中,您必须指定存储库位置和依赖项,然后gradle应该按照您的预期构建项目。

您应该能够使用" init"将版本1.11中的maven项目转换为gradle项目。插入。

gradle init --type pom