'artifactId' with value 'java' does not match a valid id pattern

编译项目报错:

"C:\Program Files\Java\jdk1.7.0_80\bin\java" "-Dmaven.home=D:\Program Files\apache-maven-3.0.5" "-Dclassworlds.conf=D:\Program Files\apache-maven-3.0.5\bin\m2.conf" -Didea.launcher.port=7537 "-Didea.launcher.bin.path=D:\Program Files\JetBrains\IntelliJ IDEA 2016.1.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\apache-maven-3.0.5\boot\plexus-classworlds-2.4.jar;D:\Program Files\JetBrains\IntelliJ IDEA 2016.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.1.4 -X clean compile
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: D:\Program Files\apache-maven-3.0.5
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_80\jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from D:\Program Files\apache-maven-3.0.5\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\123\.m2\settings.xml
[DEBUG] Using local repository at D:\Program Files\myMavenRepository\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for D:\Program Files\myMavenRepository\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.shu:thinking in java:war:1.0-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] 'artifactId' with value 'thinking in java' does not match a valid id pattern. @ line 5, column 17

	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
	at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
[ERROR]   
[ERROR]   The project com.shu:thinking in java:1.0-SNAPSHOT (D:\IntelliJ_IDEA_Project\ThinkingInJava\pom.xml) has 1 error
[ERROR]     'artifactId' with value 'thinking in java' does not match a valid id pattern. @ line 5, column 17
[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/ProjectBuildingException

Process finished with exit code 1


Solution:

Dont give the artifact id with spaces.

Eg:

thinking in java– invalid artifact id.

thinkinginjava – valid artifact id.

结论:artifact 定义时不能有空格!

你可能感兴趣的:(Java)