简体   繁体   中英

maven can't find jar file in JFrog artifactory (snapshot-repo) with third-party libs

My team is using JFrog artifactory and it has a 3rd-party lib deployed to it.

My settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
    <profile>
        <id>dev</id>
        <properties>
            <artifactory.url>http://myartifactory.com</artifactory.url>
            <artifactory.username>blah</artifactory.username>
            <artifactory.passwd>blah</artifactory.passwd>
            <artifactory.maven.snapshot>maven-integration-local</artifactory.maven.snapshot>
            <artifactory.maven.thirdparty>maven-third-party-local</artifactory.maven.thirdparty>
            <artifactory.maven.rc>maven-release-candidate-local</artifactory.maven.rc>
            <artifactory.maven.release>maven-release-local</artifactory.maven.release>
            <artifactory.maven.all>maven-repo</artifactory.maven.all>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>snapshot-repo</id>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>interval:1</updatePolicy>
                </snapshots>
                <name>maven-integration-local</name>
                <url>http://myartifactory.com</url>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>jcenter</id>
                <url>http://jcenter.bintray.com</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </pluginRepository>
            <pluginRepository>
                <id>artifactory-plugin</id>
                <url>${artifactory.url}/${artifactory.maven.all}</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

The artifactory contains a pom, which my own project is dependent on (BOM style import of pom to build my own local project). And it looks like maven is successfully downloading everything FINE until it gets to a specific jar:

Could not resolve dependencies for project xxx:1.1.0: The following artifacts could not be resolved: com.japisoft:xmlpad-res:jar:3.7

I checked and the jar does indeed exist in the artifactory (xmlpad-res-3.7.jar), but maven claims that it can't find it. I tried downloading the jar and installing it using maven install plugin, but this did not help.

Why can't maven find the file and what can I do about it?

I encountered the same problem when mistakenly removed/modified the maven .settings file;

To fix that try the following steps:

  1. Start by updating your local jars in .m2 folder: Right click on your project > Maven > Update Project (check the ' force ' check box)
  2. Now check your local repository by browsing to your .m2 folder; search for the missing jar (should be located exactly as it's defined in the pom; ie .m2/repository/path/to/your/jar )
  3. Check your maven settings in .settings.xml file (usually in .m2 folder); browse directly to the paths specified in the file or in your pom to verify the connection
  4. Check that your jfrog repository is up an running; try to restart the server and update your project again; check the .m2 folder again (in my case I had xxx.lastupdate files but no jars)
  5. Check your jfrog log for more details on the problem; check this for more details on how to find the logs: https://www.jfrog.com/confluence/display/RTF/Artifactory+Log+Files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM