mvn install not creating jar files in the local repository

13,049

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.

Share:
13,049

Related videos on Youtube

cybertextron
Author by

cybertextron

just me.

Updated on June 04, 2022

Comments

  • cybertextron
    cybertextron almost 2 years

    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] ------------------------------------------------------------------------
    
    • user2953113
      user2953113 over 8 years
      <groupId> is missing.
    • Krzysztof Krasoń
      Krzysztof Krasoń over 8 years
      <groupId> is taken from parent, so it is not missing
    • cybertextron
      cybertextron over 8 years
      @krzyk so I should also have a group id for the dependency?
    • Krzysztof Krasoń
      Krzysztof Krasoń over 8 years
      @philippe please correct the name of the package, yoou write that it is utils but in the logs you provided it is util
    • Krzysztof Krasoń
      Krzysztof Krasoń over 8 years
      @philippe <dependency> always has to have groupId (maven will scream if it doesn't), you don't need groupId in the above pom, because you inherit from parent which has groupId defined
    • user2953113
      user2953113 over 8 years
      Are there any settings for maven-install-plugin in this pom or parent pom?
    • cybertextron
      cybertextron over 8 years
      @user2953113 everything is working now ... but I know there's a problem there. The only thing different I did was mvn clean install -DskipTests -P-generateLicenses from the myapp directory
  • cybertextron
    cybertextron over 8 years
    there isn't a [INFO] Installing step in the logs ... However I can find util-1.0-SNAPSHOT.jar in the ..util/target directory ... how can I fix that?
  • user2953113
    user2953113 over 8 years
    It's the package phase that created the jar file in target directory. No need to fix it.
  • JPS
    JPS about 3 years
    This is funny.. because there it is in your own log: Installing myapp/util/target/util-1.0-SNAPSHOT.jar to ~/.m2/repository/com/myapp/app/util/1.0-SNAPSHOT/util-1.0-SN‌​APSHOT.jar
  • JPS
    JPS about 3 years
    btw, thank you @Krzysztof Krasoń the installing line showed me that i was installing to a different local repository. exact solution.