Harsha
Harsha

Reputation: 389

Issue with dependencies that are present in remote repository

In the pom.xml of the project it is having a dependency to be downloaded from the Remote repository.

<parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>1.567</version>
</parent>

<repositories>
    <repository>
        <id>repo.jenkins-ci.org</id>
        <url>http://repo.jenkins-ci.org/public/</url>
    </repository>
</repositories>

What I understand is Maven

  1. Searches in the local repository, if it is not found
  2. Searches in the local corporate nexus repository, if it is not found
  3. Should download from the remote repository

When I execute the command mvn test it showing the trace as below

In the error it is showing that it is downloading from the local nexus repository

Could not find artifact org.jenkins-ci.plugins:plugin:pom:1.567 in nexus (http://localnexus/nexus/content/groups/group/) and 'parent.relativePath' points at no local POM 

Can anyone please help me in resolving this.. Is it something related to proxy settings?,

as it is not going to the remote repository link..

 D:\Hygieia-master\hygieia-jenkins-plugin>mvn test

[INFO] Scanning for projects…

Downloading: http://localnexus/nexus/content/groups/group/org/jenkins-ci/plugins/plugin/1.567/plugin-1.567.pom

Downloading: http://repo.jenkins-ci.org/public/org/jenkins-ci/plugins/plugin/1.567/plugin-1.567.pom

[ERROR] [ERROR] Some problems were encountered while processing the POMs:

[FATAL] Non-resolvable parent POM for org.jenkins-ci.plugins:hygieia-publisher:1.4-SNAPSHOT: Could not find artifact org.jenkins-ci.plugins:plugin:pom:1.567 in nexus (http://localnexus/nexus/content/groups/group/) and 'parent.relativePath' points at no local POM @ line 15, column 13
 @

[ERROR] The build could not read 1 project -> [Help 1]

[ERROR]
[ERROR]   The project org.jenkins-ci.plugins:hygieia-publisher:1.4-SNAPSHOT (D:\Hygieia-master\hygieia-jenkins-plugin\pom.xml) has 1 error

[ERROR]     Non-resolvable parent POM for org.jenkins-ci.plugins:hygieia-publisher:1.4-SNAPSHOT: Could not find artifact org.jenkins-ci.plugins:plugin:pom:1.567 in nexus (http://localnexus/nexus/content/groups/group/) and 'parent.relativePath' points at no local POM @ line 15, column 13 -> [Help 2]
[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/ProjectBuildingException

[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Below is my Settings.xml

  <settings>
    <servers>
        <server>
            <id>nexus</id>
            <username>user</username>
            <password>pwd</password>
            <configuration>
                <httpConfiguration>
                    <all>
                        <params>
                            <param>
                                <name>http.authentication.preemptive</name>
                                <value>%b,true</value>
                            </param>
                        </params>
                    </all>
                </httpConfiguration>
                <httpHeaders>
                    <property>
                        <name>username</name>
                        <value>user</value>
                    </property>
                </httpHeaders>
            </configuration>
        </server>
    </servers>

  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>central</mirrorOf>
      <url>http://localnexus/nexus/content/groups/group/</url>
    </mirror>   
  </mirrors>
  <profiles>
    <profile>   
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>

      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>

      </pluginRepositories>
      <properties>
              <archetypeCatalog>http://localnexus/nexus/content/groups/PUBLIC_REPO/</archetypeCatalog>
      </properties>

    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>




</settings>

Upvotes: 1

Views: 702

Answers (1)

skm
skm

Reputation: 426

This is similar to this question

If your parent pom is fetched from remote repositories ,then you can modify your parent tag as

    <parent>
        <groupId>org.jenkins-ci.plugins</groupId>
        <artifactId>plugin</artifactId>
        <version>1.567</version>
        <relativePath></relativePath>
    </parent>

Adding an empty relativepath will resolve the parent POM from the repositories. If relativePath is not specified, it defaults to ../pom.xml.

From the doc,

The relative path of the parent pom.xml file within the check out. If not specified, it defaults to ../pom.xml. Maven looks for the parent POM first in this location on the filesystem, then the local repository, and lastly in the remote repo. relativePath allows you to select a different location, for example when your structure is flat, or deeper without an intermediate parent POM. However, the group ID, artifact ID and version are still required, and must match the file in the location given or it will revert to the repository for the POM. This feature is only for enhancing the development in a local checkout of that project. Set the value to an empty string in case you want to disable the feature and always resolve the parent POM from the repositories. Default value is: ../pom.xml.

Refer here for the doc.

Upvotes: 1

Related Questions