0
votes

I have created a Private Local Maven Repository for dependency handling from Central Maven Server. I have taken a sample project from JFrog's Maven Example to build the sample project.

I have followed all the steps for setting up the repository and able to make it up and running. When I try to build the application downloaded from https://github.com/jfrog/project-examples and the project is maven-example, I'm getting the following error.

**root@xyz:/home/asdf/Downloads/mavenrepository/project-examples/maven-example# mvn deploy -U**

[INFO] Scanning for projects...

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Build Order:

[INFO]

[INFO] Simple Multi Modules Build                                         [pom]

[INFO] Multi 1                                                            [jar]

[INFO] Multi 2                                                            [jar]

[INFO] Multi 3                                                            [war]

[INFO]

[INFO] ------------------------< org.jfrog.test:multi >------------------------

[INFO] Building Simple Multi Modules Build 3.7-SNAPSHOT                   [1/4]

[INFO] --------------------------------[ pom ]---------------------------------

Downloading from central: http://localhost:8081/artifactory/libs-release/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom

Downloading from snapshots: http://localhost:8081/artifactory/libs-snapshot/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom

[WARNING] The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.4 is missing, no dependency information available

Downloading from central: http://localhost:8081/artifactory/libs-release/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar

Downloading from snapshots: http://localhost:8081/artifactory/libs-snapshot/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary for Simple Multi Modules Build 3.7-SNAPSHOT:

[INFO]

[INFO] Simple Multi Modules Build ......................... FAILURE [  0.636 s]

[INFO] Multi 1 ............................................ SKIPPED

[INFO] Multi 2 ............................................ SKIPPED

[INFO] Multi 3 ............................................ SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  0.750 s

[INFO] Finished at: 2020-05-20T03:00:55+02:00

[INFO] ------------------------------------------------------------------------

[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-install-plugin:jar:2.4 in central (http://localhost:8081/artifactory/libs-release) -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

I have already run the maven command mvn deploy -U to try to download the plugin and upload it to libs-release but it didn't work

I have also tried using the maven command mvn dependency:purge-local-repository but this also didn't update the required plugins.

Now, how can we make the maven to download all the plugins again while building it and upload those plugins to JFrog Artifactory.

Also How to configure Maven settings.xml to download plugins which are not available in JFrog Artifactory / Private Internal Maven Repository and to get it from Maven Central Server i.e., if a dependency is not available in Private Internal Maven Repository, Maven should download it from Central Maven Repository.

Please help support.

settings.xml file

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
  <servers>
    <server>
      <username>xyz</username>
      <password>xyz_pass</password>
      <id>central</id>
    </server>
    <server>
      <username>admin</username>
      <password>admin_password</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://localhost:8081/artifactory/libs-release</url>       
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://localhost:8081/artifactory/libs-snapshot</url>          
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://localhost:8081/artifactory/libs-release</url>             
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://localhost:8081/artifactory/libs-snapshot</url>          
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

Trace:
Request ID: 2ba338df
Repo Path ID: libs-release:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
Method Name: GET
User: admin
Time: 2020-05-26T10:32:01.113+02:00
Thread: http-nio-8081-exec-9
Steps: 
2020-05-26T10:32:01.113+02:00 Received request
2020-05-26T10:32:01.114+02:00 Request source = 10.XXX.XXX.XXX, Last modified = 01-01-70 00:59:59 +01:00, If modified since = -1, Thread name = http-nio-8081-exec-9
2020-05-26T10:32:01.114+02:00 Executing any BeforeDownloadRequest user plugins that may exist
2020-05-26T10:32:01.114+02:00 Retrieving info from virtual repository 'libs-release' type Maven
2020-05-26T10:32:01.114+02:00 Consulting the virtual repo download strategy
2020-05-26T10:32:01.114+02:00 Trying to retrieve resource info from the local storage
2020-05-26T10:32:01.114+02:00 Unable to find resource in libs-release:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.114+02:00 Intercepting cached virtual resource with 'MavenMetadataInterceptor'
2020-05-26T10:32:01.114+02:00 Intercepting cached virtual resource with 'PomInterceptor'
2020-05-26T10:32:01.114+02:00 Searching for info in aggregated repositories
2020-05-26T10:32:01.114+02:00 Preparing list of aggregated repositories to search in
2020-05-26T10:32:01.114+02:00 Appending the nested virtual repository 'libs-release'
2020-05-26T10:32:01.115+02:00 Appending collective local repositories
2020-05-26T10:32:01.115+02:00 Appending collective local cache repositories
2020-05-26T10:32:01.115+02:00 Appending collective remote repositories
2020-05-26T10:32:01.115+02:00 Intercepting info request with 'MavenMetadataInterceptor'
2020-05-26T10:32:01.115+02:00 Intercepting info request with 'PomInterceptor'
2020-05-26T10:32:01.115+02:00 Processing request as a release resource
2020-05-26T10:32:01.115+02:00 Searching for the resource within libs-release-local
2020-05-26T10:32:01.115+02:00 Unable to find resource in libs-release-local:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.115+02:00 Searching for the resource within jcenter-cache
2020-05-26T10:32:01.115+02:00 Unable to find resource in jcenter-cache:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.115+02:00 Searching for the resource within jcenter
2020-05-26T10:32:01.116+02:00 Unable to find resource in jcenter-cache:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.116+02:00 Repository is assumed offline and the resource doesn't exist in the local cache - returning unfound resource
2020-05-26T10:32:01.116+02:00 Returning an unfound resource
2020-05-26T10:32:01.116+02:00 Requested resource is found = false
2020-05-26T10:32:01.116+02:00 Requested resource is blocked = false
2020-05-26T10:32:01.116+02:00 Request is HEAD = false
2020-05-26T10:32:01.116+02:00 Request is for a checksum = false
2020-05-26T10:32:01.116+02:00 Target repository is not remote or doesn't store locally = true
2020-05-26T10:32:01.116+02:00 Requested resource was not modified = false
2020-05-26T10:32:01.116+02:00 Responding with unfound resource
2020-05-26T10:32:01.116+02:00 Setting default response status to '404' reason to 'Resource not found'
2020-05-26T10:32:01.116+02:00 Response is an instance of UnfoundRepoResourceReason
2020-05-26T10:32:01.116+02:00 Configured to hide un-authorized resources = false
2020-05-26T10:32:01.116+02:00 Original response status is auth related = false
2020-05-26T10:32:01.116+02:00 Using original response status of '404' and message 'Could not find resource'
2020-05-26T10:32:01.116+02:00 Sending error with status 404 and message 'Could not find resource'
2020-05-26T10:32:01.116+02:00 Executing any AfterDownloadErrorAction user plugins that may exist
2020-05-26T10:32:01.116+02:00 Response code wasn't modified by the user plugins
2020-05-26T10:32:01.116+02:00 Sending response with the status '404' and the message 'Could not find resource'
1
Try requesting localhost:8081/artifactory/libs-release/org/apache/maven/… in order to figure out why this pom file is not fetched from the remote repository - Dror Bereznitsky
@DrorBereznitsky It was told that on First Run of the Maven Project the dependencies will be added to the Artifactory but it didn't happen in my case were I followed the tutorial for updating the settings.xml from the following link. Also i tried to upload the most of the plugins to libs-release-local using the CURL command and partially succeeded. youtube.com/… - user2114103
@DrorBereznitsky I have added the settings.xml file content in the end which i have configured now. - user2114103
@DrorBereznitsky Full Trace has been added in the end of code - user2114103
Could it be a firewall issue? - assylias

1 Answers

0
votes

Based on the trace provided in the question, the issue seems to be with access to the JCenter public repository.
The following lines in the trace is showing that the requested artifact in not cached locally and Artifactory is trying to request it from JCenter, but it is assumed offline:

2020-05-26T10:32:01.115+02:00 Searching for the resource within jcenter
2020-05-26T10:32:01.116+02:00 Unable to find resource in jcenter-cache:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.116+02:00 Repository is assumed offline and the resource doesn't exist in the local cache - returning unfound resource

This means that Artifactory did not manage to reach to jcenter a couple of times with success and eventually marked it as offline.
This can happen for several reasons, including as suggested in the comments a firewall which is blocking outgoing traffic to JCenter.
The best way to troubleshoot it would be getting the JCenter repository URL from the repository configuration and making sure you have network access to it.
One thing to notice regarding JCenter - recently, for security reasons, it started enforcing the use of secure HTTP (https). There is a chance your configuration is still using non secure HTTP, which can lead to requests failing.