Maven in 5 Minutes issue

前端 未结 6 1429
夕颜
夕颜 2021-02-14 04:17

I\'m following Maven in 5 Minutes manual with the following:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-a         


        
6条回答
  •  深忆病人
    2021-02-14 04:59

    It just took me 75 minutes to create a Maven quickstart project on Windows 10 using PowerShell in batch mode. Apparently I made three different mistakes.

    Do the following:

    • Provide all mandatory parameters or batch mode won't work. This is poorly documented in the official Maven tutorial, but correctly documented here:
      • -B for batch mode or -DinteractiveMode=false instead
      • -DarchetypeGroupId=org.apache.maven.archetypes
      • -DarchetypeArtifactId=maven-archetype-quickstart
      • -DarchetypeVersion=1.1
      • -DgroupId=com.example
      • -DartifactId=app
      • -Dversion=1.0-SNAPSHOT
      • -Dpackage=com.example.project
    • In PowerShell you have to use double quotes around every parameter, e.g. "-DgroupId=com.example"
    • Don't use line breaks in your archetype:generate command

    Full example:

    mvn archetype:generate -B "-DarchetypeGroupId=org.apache.maven.archetypes" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.1" "-DgroupId=com.example" "-DartifactId=app" "-Dversion=1.0-SNAPSHOT" "-Dpackage=com.example.project"
    

提交回复
热议问题