Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvn install not creating jar files in the local repository

Tags:

java

maven

ant

I have a pom.xml file for my util direction, inside my project:

   <?xml version="1.0" encoding="UTF-8"?>
   <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>com.myapp.app</groupId>
            <artifactId>MyApp</artifactId>
            <version>1.0-SNAPSHOT</version>
        </parent>

       <artifactId>util</artifactId>
       <packaging>jar</packaging>
       <version>1.0-SNAPSHOT</version>
       <name>Util</name>
       <url>http://maven.apache.org</url>
         ...
         <other things here>
       </project>

When I execute mvn clean install, it works fine. However, when I try to use that util dependency I get:

[ERROR] Failed to execute goal on project helloworld: Could not resolve dependencies for project com.myapp.app:helloworld:jar:1.0-SNAPSHOT: Could not find artifact com.myapp.app:util:jar:1.0-SNAPSHOT -> [Help 1]

Looking into ~/.m2/repository/ I don't see a util directory. Why is that happening? How can I have maven to install those packages in the local repository?

************************** Last 15 lines *******************
[INFO] Copying jdom-1.0.jar to myapp/util/target/dependency/jdom-1.0.jar
[INFO] Copying httpclient-4.2.6.jar to /myapp/util/target/dependency/httpclient-4.2.6.jar
[INFO] Copying maven-scm-provider-svn-commons-1.4.jar to myapp/util/target/dependency/maven-scm-provider-svn-commons-1.4.jar
[INFO] Copying aws-java-sdk-cloudsearch-1.9.34.jar to myapp/util/target/dependency/aws-java-sdk-cloudsearch-1.9.34.jar
[INFO] Copying jdom2-2.0.4.jar to myapp/util/target/dependency/jdom2-2.0.4.jar
[INFO] Copying poi-scratchpad-3.12-beta1.jar to myapp/util/target/dependency/poi-scratchpad-3.12-beta1.jar
[INFO] Copying aws-java-sdk-cognitoidentity-1.9.34.jar to myapp/util/target/dependency/aws-java-sdk-cognitoidentity-1.9.34.jar
[INFO] Copying elasticsearch-1.4.2.jar to myapp/util/target/dependency/elasticsearch-1.4.2.jar
[INFO] Copying c3p0-0.9.1.1.jar to myapp/util/target/dependency/c3p0-0.9.1.1.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ util ---
[INFO] Installing myapp/util/target/util-1.0-SNAPSHOT.jar to ~/.m2/repository/com/myapp/app/util/1.0-SNAPSHOT/util-1.0-SNAPSHOT.jar
[INFO] Installing myapp/util/pom.xml to ~/.m2/repository/com/myapp/app/util/1.0-SNAPSHOT/util-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.855 s
[INFO] Finished at: 2015-09-22T11:32:59-07:00
[INFO] Final Memory: 43M/465M
[INFO] ------------------------------------------------------------------------
like image 759
cybertextron Avatar asked Sep 22 '15 18:09

cybertextron


1 Answers

When you do mvn clean install, please take a look at [INFO] Installing line and see where it installs your package, maybe your config is wrong.

Log above shows that the package installed correctly. Please show us how you define dependency to utilize in hello world.

like image 172
Krzysztof Krasoń Avatar answered Oct 05 '22 19:10

Krzysztof Krasoń