오류를 보면 어느 라인이 잘못되어있는지 정확히 알려주니 pom.xml 에서 해당 라인을 확인해 보면 된다.
증상 1
mvn install 또는 mvn clean install 할 시 다음과 같이 나온다.
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.sonatype.mavenbook.ch06:simple-parent:1.0 (/home/lucifer/test/maven/simple-parent/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.sonatype.mavenbook.ch06:parent:pom:1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 13, column 11 -> [Help 2]
[ERROR]
[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
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
lucifer@lucifer-Vostro-V13:~/test/maven/simple-parent$
다중 프로젝트 부분에서 여러개의 pom.xml 이 있는데 해당 pom.xml 이 가장 상위 pom 인데 parent 가 설정되어 있어서 문제가 발생함.
다음 부분을 주석처리함.
<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>simple-parent</artifactId> <packaging>pom</packaging> <version>1.0</version> <name>Chapter 6 Simple Parent Project</name> <modules> <module>simple-weather</module> <module>simple-webapp</module> </modules> <parent> <artifactId>parent</artifactId> <groupId>org.sonatype.mavenbook.ch06</groupId> <version>1-SNAPSHOT</version> </parent> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </pluginManagement> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
증상 2
mvn install 또는 mvn clean install 할 시 다음과 같이 나온다.
[INFO] Scanning for projects...
[ERROR] The build could not read 2 projects -> [Help 1]
[ERROR]
[ERROR] The project org.sonatype.mavenbook.ch06:simple-weather:1-SNAPSHOT (/home/lucifer/test/maven/simple-parent/simple-weather/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.sonatype.mavenbook.ch06:simple-parent:pom:1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 4, column 11 -> [Help 2]
[ERROR]
[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
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
lucifer@lucifer-Vostro-V13:~/test/maven/simple-parent$
다중 프로젝트에서 상위 pom.xml 에서의 version 정보가 하위 pom.xml 에서 지정한 parent version 정보와 달라서 문제가 발생했다.
다음과 같이 버전정보를 똑같이 맞추어 주었다.
상위 pom.xml
<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>simple-parent</artifactId> <groupId>org.sonatype.mavenbook.ch06</groupId> <packaging>pom</packaging> <version>1.0</version> <name>Chapter 6 Simple Parent Project</name> <modules> <module>simple-weather</module> <module>simple-webapp</module> </modules> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </pluginManagement> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
하위 pom.xml
<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.sonatype.mavenbook.ch06</groupId> <artifactId>simple-parent</artifactId> <version>1.0</version> </parent> <artifactId>simple-webapp</artifactId> <packaging>war</packaging> <name>Chapter 6 Simple Web Application Project</name> <dependencies> <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-servlet_2.4_spec</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>org.sonatype.mavenbook.ch06</groupId> <artifactId>simple-weather</artifactId> <version>${project.version}</version> </dependency> </dependencies> <build> <finalName>simple-webapp</finalName> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> </plugin> </plugins> </build> </project>
댓글
댓글 쓰기