Maven in 5 Minutes issue

前端 未结 6 1439
夕颜
夕颜 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:47

    I am using Windows 7 SP1.

    I was having the problem because I ran it using PowerShell.

    It works fine when I ran it using CMD.EXE.

    Thanks for everyone's help.

    0 讨论(0)
  • 2021-02-14 04:48

    I ran into the same problem, and it looks like we have the similar setup

    • Windows 7
    • Powershell
    • HTTP proxy

    here is what I have to do:

    1. Wrap all the "-D..." inside double quotes, e.g.

      mvn archetype:generate "-DarchetypeGroupId=org.apache.maven.archetypes" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DgroupId=com.mycompany.app" "-DartifactId=my-app"
      
    2. Make sure you have "HTTP_PROXY" set properly in your envrironment variables (check it by typing "echo $Env:HTTP_PROXY")

    0 讨论(0)
  • 2021-02-14 04:54

    I am not sure that you are running "mvn compile" from POM directory and that is why it is asking for POM.

    If so, simply go to directory where pom is located and then fire "mvn install" or any other Maven commands.

    0 讨论(0)
  • 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"
    
    0 讨论(0)
  • 2021-02-14 05:05

    First, you should follow the advice of the error message. Call Maven with the additional flags to get more information.

    Second, you should ensure that your internet connection is working from the command line. Are you able for example to download http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/2.2/maven-archetype-plugin-2.2.pom from your browser? If not, Maven is not able to download the necessary plugins, and so the normal bootstrapping that is necessary before your project can be build is not done. Check if your browser is using a proxy, and you don't have defined an environment variable HTTP_PROXY. If that is the case, define in the shell you are using your variable HTTP_PROXY by the command:

    set HTTP_PROXY=http://<my.proxy.host>:<port>
    

    with the right values for my.proxy.host and port. If that works then well, define the environment variable for the system, so that every open shell has that environment variable defined.

    Please add that information to your question, and sorry for the wrong advice to call ping http://...., that cannot work.

    0 讨论(0)
  • 2021-02-14 05:07

    I had a similar error and tried using double quotes to wrap all -D and it worked for me..

    Example:

    mvn archetype:create "-DarchetypeGroupId=org.springframework.ws" "-DarchetypeArtifactId=spring-ws-archetype" "-DarchetypeVersion=2.1.4.RELEASE" "-DgroupId=com.mycompany.hr" "-DartifactId=holidayService"
    
    0 讨论(0)
提交回复
热议问题