maven clean install not taking jar from local repository

21,864

Solution 1

Try running maven offline mvn clean install -o. This will pick jars from your local repository i.e in .m2. As you mentioned jar is already in local repo, and if all other dependencies are also in local, this will work.

Solution 2

When snapshot depedencies are used, maven checks stable or updated depedencies.And that is what happening in your casse. In you repository config in pom.xml you need to set updaate policy for Snapshot as:

<repository>
    <id>a-repository</id>
    <url>http://3.204.29.172:8081/artifactory/repo</url>
    <snapshots>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
    </snapshots>
</repository>

<updatePolicy>never</updatePolicy> .. This will disable the check and download for snapshot dependency

For more details refer

Share:
21,864
Admin
Author by

Admin

Updated on December 31, 2020

Comments

  • Admin
    Admin over 3 years

    I am trying to run mvn clean install command from command line. At one location it is trying to download the jar from remote location.

    [INFO] Deleting directory C:\Users\212368997\ruchita_pdm_laptop\vobs\iui\src\newsrc\xr-service-impl\target
    [INFO] [resources:resources]
    [INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    Downloading:     http://3.204.29.172:8081/artifactory/repo1/com/gehc/xr/wf/DuifEventsData/1.0.0-SNAPSHOT/DuifEventsData-1.0.0-SNAPSHOT.jar
    [WARNING] Unable to get resource 'com.gehc.xr.wf:DuifEventsData:jar:1.0.0-SNAPSHOT'  from repository xr-workflow-repository (http://3.204.29.172:8081/artifactory/repo
    1): Error transferring file: Connection timed out: connect
    Downloading:     http://3.204.29.172:8081/artifactory/repo1/com/gehc/xr/wf/DuifEventIdVal/1.0.0-  SNAPSHOT/DuifEventIdVal-1.0.0-SNAPSHOT.jar
    

    and the process halts. I have

    DuifEventsData-1.0.0-SNAPSHOT.jar

    jar at the local repository in .m2 folder then also it is trying to download the jar from [(http://3.204.29.172:8081/...]
    what is the solution for this ?

    • Brian Roach
      Brian Roach over 10 years
      What is the full path in your .m2 ?
  • Admin
    Admin over 10 years
    The same .m2 repository I am using in eclipse and it gives no problem.
  • Admin
    Admin over 10 years
    mvn clean install -o -Dmaven.test.skip=true solved my problem.