进入pom文件所在的目录,执行gradle init --type pom --info --info表示打印信息,发现报错了,这时只需在pom.xml中增加<packaging>pom</packaging>即可
Initialized native services in: C:\Users\peng\.gradle\native
The client will now receive all logging from the daemon (pid: 2956). The daemon log file: C:\Users\peng\.gradle\daemon\4.9\daemon-2956.out.log
Starting 5th build in daemon [uptime: 6 mins 3.547 secs, performance: 100%, no major garbage collections]
Using 4 worker leases.
Starting Build
Settings evaluated using settings file 'H:\management\settings.gradle'.
Projects loaded. Root project using build file 'H:\management\build.gradle'.
Included projects: [root project 'management']
> Configure project :
Evaluating root project 'management' using build file 'H:\management\build.gradle'.
All projects evaluated.
Selected primary task 'init' from project :
Tasks to be executed: [task ':wrapper', task ':init']
:wrapper (Thread[Task worker for ':',5,main]) started.
> Task :wrapper UP-TO-DATE
Skipping task ':wrapper' as it is up-to-date.
:wrapper (Thread[Task worker for ':',5,main]) completed. Took 0.013 secs.
:init (Thread[Task worker for ':',5,main]) started.
> Task :init FAILED
Task ':init' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Maven to Gradle conversion is an incubating feature.
:init (Thread[Task worker for ':',5,main]) completed. Took 0.177 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':init'.
> Could not convert Maven POM H:\management\pom.xml to a Gradle build.
> Unable to create Maven project model using POM H:\management\pom.xml.
> Some problems were encountered while processing the POMs:
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 3, column 109
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
2 actionable tasks: 1 executed, 1 up-to-date
成功执行