Reputation: 2441
I have a project called reservationVol
which I want to include in an mvc spring project called reservationVolMvc
. I compiled and tested reservationVol
on eclipse. I also use the maven commands: mvn compile
and mvn package
. All tests ran successfully.
When I tried to compile reservationVolMvc
using the mvn compile
command I get the following error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building reservationVolSpring 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for hani.reservationVol:reservationVol:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.688 s
[INFO] Finished at: 2016-11-23T12:25:21+01:00
[INFO] Final Memory: 6M/77M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project reservationVolSpring: Could not resolve dependencies for project formation.addstones:reservationVolSpring:war:1.0-SNAPSHOT: Could not find artifact hani.reservationVol:reservationVol:jar:1.0-SNAPSHOT -> [Help 1]
[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/DependencyResolutionException
The following pom.xml files represent the dependencies for respectively reservationVol
and reservationVolMvc
. I included the project ReservationVol
in reservationVolMvc
by using the following:
<dependency>
<groupId>hani.reservationVol</groupId>
<artifactId>reservationVol</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<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>
<groupId>hani.reservationVol</groupId>
<artifactId>reservationVol</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>reservationVol</name>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.5.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
<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>
<groupId>formation.addstones</groupId>
<artifactId>reservationVolSpring</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>reservationVolSpring</name>
<dependencies>
<dependency>
<groupId>hani.reservationVol</groupId>
<artifactId>reservationVol</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.2.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Upvotes: 18
Views: 170337
Reputation: 39
I faced the same issue, I ran:
mvn compile dependency:tree
and after that it compiled without any problem.
Upvotes: 0
Reputation: 243
I was facing the same issue, I had a parent project that would fail on the Clean Install of a dependent project.
I tried all of the above solutions to no avail, running clean install both in eclipse and from command line.
I was able to solve by navigating to the Child Project and Running the following
mvn clean
mvn eclipse:eclipse
(this forced download of missing jars)mvn clean install -U
mvn clean install -DskipTests -P(if necessary a profile here) -U
This helped when maven was not downloading jar's properly listed in the pom.xml, I was not able to find why clean install with Update Snapshots/etc. did not download the missing jars.
Upvotes: 7
Reputation: 5871
Do a mvn clean install
.
This will clean whatever created from the previous build, then build your project and add the jars to your local maven repository (.m2\repository)
Upvotes: 23
Reputation: 139
I also faced the same problem...................Issue got resolved
Do a maven clean and install of the child project and then try
maven clean and install of parent project.
For reference watch these videos https://www.youtube.com/watch?v=2aNC1EAnpqo https://www.youtube.com/watch?v=EMfd2FwKKHY
Upvotes: 12