0
votes

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?

1
find maven repository and put the file there, also add dependency in the pom.xml, simple as that. In case you have no idea how to find it: mkyong.com/maven/where-is-maven-local-repository - PSo
@PatrickSo thanks for your comment. I think that is what the repositories section is attempting to do. The file is located in my artifactory repository. However, maven is unable to download it from there for some strange reason. Also note that I have tried using maven installer plugin to install the plugin to the local maven repo, but it still cannot find it. I don't think i need to add a repository definition for the local repo? Correct me if I'm wrong. - Nena
Maven shows the path it tries to resolve the artifact from. Copy it and paste in the browser, adding ?trace in the end of the URL. This should give you the troubleshooting trace on how Artifactory tries to resolve the artifact and why it ends up 404. That might help. If not, please add the trace output to the question and we'll take it from there. - JBaruch

1 Answers

1
votes

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; i.e. .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