java - Maven build failure - første installation

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg er en nybegynder, der forsøger at installere og oprette mit første projekt.
Jeg har installeret Maven på Windows 8 og jeg møder problem.


Jeg oprettede ikke en settings.xml-fil.
Denne kommando ser ud til at afsløre et problem:


mvn-x:
mvn -X 1
mvn-X 2 [4] [5]


og hvis jeg forsøger at oprette et quickstart-projekt, får jeg det her:


mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1


mvn arketype: generere -DarketypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1 [6]


Jeg finder ikke en måde at løse dette problem på, selv ved at se på andre emner på internettet, kan jeg hjælpe?


EDIT 1 ------------------------------------------------ ----------------


Med tis kommando:


mvn -X archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1


Her er de sidste fejlretningslinjer, jeg kan, kopiere/indsætte her:


[DEBUG] Velocimacro : Velocimacro : initialization complete.
[DEBUG] RuntimeInstance successfully initialized.
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate' with basic configurator -->
[DEBUG]   (f) archetypeArtifactId = maven-archetype-quickstart
[DEBUG]   (f) archetypeCatalog = remote,local
[DEBUG]   (f) archetypeVersion = 1.1
[DEBUG]   (f) basedir = C:Program Filesapache
epository
[DEBUG]   (f) interactiveMode = true
[DEBUG]   (f) localRepository =       id: local
      url: file:///C:/Users/B/.m2/repository/
   layout: default
snapshots: [enabled => true, update => always]
 releases: [enabled => true, update => always]

[DEBUG]   (f) remoteArtifactRepositories = [      id: central
      url: https://repo.maven.apache.org/maven2
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@320a8ebf
[DEBUG] -- end configuration --
[INFO] Generating project in Interactive mode
[DEBUG] Searching for remote catalog: https://repo.maven.apache.org/maven2/archetype-catalog.xml
[DEBUG] Using catalog C:UsersB.m2
epositoryarchetype-catalog.xml
[DEBUG] Not found archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 in cache
[DEBUG] Found archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 in cache: C:UsersB.m2
epositoryorgapach
[DEBUG] checking fileset archetype status on C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-quickstart1.
[DEBUG] Searching for META-INF/maven/archetype-metadata.xml inside C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-a
[DEBUG]   - META-INF/maven/archetype.xml
[DEBUG]   - META-INF/DEPENDENCIES
[DEBUG]   - META-INF/LICENSE
[DEBUG]   - META-INF/NOTICE
[DEBUG]   - archetype-resources/pom.xml
[DEBUG]   - archetype-resources/src/test/java/AppTest.java
[DEBUG]   - archetype-resources/src/main/java/App.java
[DEBUG] Found archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 in cache: C:UsersB.m2
epositoryorgapach
[DEBUG] checking old archetype status on C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-quickstart1.1ma
[DEBUG] Searching for META-INF/maven/archetype.xml inside C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-
[DEBUG]   - META-INF/maven/archetype.xml
[DEBUG] Entry found
[DEBUG] Found archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 in cache: C:UsersB.m2
epositoryorgapach
[DEBUG] Searching for META-INF/maven/archetype.xml inside C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-
[DEBUG]   - META-INF/maven/archetype.xml
[DEBUG] Entry found
[DEBUG] Creating ArchetypeConfiguration from legacy descriptor and Properties
[DEBUG] Adding requiredProperty groupId
[DEBUG] Setting property groupId=null
[DEBUG] Adding requiredProperty artifactId
[DEBUG] Setting property artifactId=null
[DEBUG] Adding requiredProperty version
[DEBUG] Setting property version=null
[DEBUG] Adding requiredProperty package
[DEBUG] Setting property package=null
[DEBUG] Required properties before content sort: [groupId, artifactId, version, package]
[DEBUG] Required properties after content sort: [groupId, artifactId, version, package]
Define value for property 'groupId': org.exemple.demo
Define value for property 'artifactId': mon-appli
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' org.exemple.demo: :
Confirm properties configuration:
groupId: org.exemple.demo
artifactId: mon-appli
version: 1.0-SNAPSHOT
package: org.exemple.demo
 Y: :
[DEBUG] Archetype generation configuration confirmed
[DEBUG] Found archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 in cache: C:UsersB.m2
epositoryorgapach
[DEBUG] Found archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 in cache: C:UsersB.m2
epositoryorgapach
[DEBUG] checking fileset archetype status on C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-quickstart1.
[DEBUG] Searching for META-INF/maven/archetype-metadata.xml inside C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-a
[DEBUG]   - META-INF/maven/archetype.xml
[DEBUG]   - META-INF/DEPENDENCIES
[DEBUG]   - META-INF/LICENSE
[DEBUG]   - META-INF/NOTICE
[DEBUG]   - archetype-resources/pom.xml
[DEBUG]   - archetype-resources/src/test/java/AppTest.java
[DEBUG]   - archetype-resources/src/main/java/App.java
[DEBUG] checking old archetype status on C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-quickstart1.1ma
[DEBUG] Searching for META-INF/maven/archetype.xml inside C:UsersB.m2
epositoryorgapachemavenarchetypesmaven-archetype-
[DEBUG]   - META-INF/maven/archetype.xml
[DEBUG] Entry found
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: C:Program Filesapache
epository
[INFO] Parameter: package, Value: org.exemple.demo
[INFO] Parameter: groupId, Value: org.exemple.demo
[INFO] Parameter: artifactId, Value: mon-appli
[INFO] Parameter: packageName, Value: org.exemple.demo
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44.131 s
[INFO] Finished at: 2018-03-13T12:28:25+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalon
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Error merging velocity templates
    at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute (CreateProjectFromArchetypeMojo.java:206)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
←[0m←[0m
C:Program Filesapache
epository>


EDIT 2 ------------------------------------------------ -----------------


Jeg fandt årsagen til problemet:


Apache-maven-3.5.3-filerne var i en mappe oprettet i c: \ Program Files.


Jeg ændrede og oprettede en mappe i roden af ​​c: \ apache \ apache-maven-3.5.3 og scriptet fungerer nu uden problemer.

Bedste reference