我的POM有问题:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>IOCProj1(Basic)</groupId>
<artifactId>IOCProj1(Basic)</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.5.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Stack:这是控制台
中显示的错误[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'groupId' with value 'IOCProj1(Basic)' does not match a valid id pattern. @ line 3, column 12
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project IOCProj1(Basic):com.nt.cfgs:0.0.1-SNAPSHOT (C:\Users\shrut\workspace\IOCProj1(Basic)\pom.xml) has 1 error
[ERROR] 'groupId' with value 'IOCProj1(Basic)' does not match a valid id pattern. @ line 3, column 12
[ERROR]
`enter code here`[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
答案 0 :(得分:6)
您不能在groupId
或artifactId
内使用括号。
这些字段由以下正则表达式验证:Maven中的[A-Za-z0-9_\\-.]+
。因此,你不能有括号;唯一有效的字符是字母数字,下划线,短划线和点。您可以将项目重命名为:
<groupId>IOCProj1_Basic</groupId>
<artifactId>IOCProj1_Basic</artifactId>
答案 1 :(得分:1)
根据DefaultModelValidator类'artifactId'和'groupId'必须匹配以下正则表达式
ID_REGEX =“[A-Za-z0-9 _ \ - 。] +” 如果您对maven pom文件的其他验证感兴趣,那么查看此类源代码将会很有帮助。 http://svn.apache.org/repos/asf/maven/maven-2/branches/maven-2.2.x/maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java
答案 2 :(得分:0)
---在创建应用程序时不应提供空格,而且项目名称和工件ID应该相同