Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.6.0 warns about missing dependencies when previous versions did not #225

Closed
MarkEWaite opened this issue Jul 20, 2022 · 3 comments · Fixed by #226
Closed

1.6.0 warns about missing dependencies when previous versions did not #225

MarkEWaite opened this issue Jul 20, 2022 · 3 comments · Fixed by #226
Labels

Comments

@MarkEWaite
Copy link

MarkEWaite commented Jul 20, 2022

With the inclusion of #220 in extra enforcer plugin 1.6.0, dependencies are reported as missing even though previous versions of the extra enforcer plugin did not warn about those dependencies and later use in the project do not report the dependencies as missing.

Background

Jenkins plugins (like the implied labels plugin) use a parent pom that includes the extra enforcer rules plugin. When plugins are upgraded to a parent pom version that uses extra enforcer rules 1.6.0, the plugin builds now received warnings like the following:

[WARNING] Missing:
----------
1) org.jenkins-ci.main:jenkins-test-harness:jar:1802.v9de0d87365d2

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.jenkins-ci.main -DartifactId=jenkins-test-harness -Dversion=1802.v9de0d87365d2 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.jenkins-ci.main -DartifactId=jenkins-test-harness -Dversion=1802.v9de0d87365d2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.jenkins-ci.main:jenkins-test-harness:jar:1802.v9de0d87365d2

----------
1 required artifact is missing.

for artifact:
  org.jenkins-ci.main:jenkins-test-harness:jar:1802.v9de0d87365d2

from the specified remote repositories:
  central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
Path to dependency:
        1) org.jenkins-ci.main:jenkins-test-harness:jar:1802.v9de0d87365d2

The dependencies that are reported as unresolvable are then later resolved in the build process without issue.

Duplicate the issue

Duplicate the issue with the commands:

$ rm -rf implied-labels-plugin
$ git clone https://github.com/jenkinsci/implied-labels-plugin.git
$ cd implied-labels-plugin
$ echo '<settings></settings>' > settings.xml
$ mvn validate

Configuration change to avoid the issue

When I was seeing the issue, my ~/.m2/settings.xml file included the following mirror definition:

  <mirrors>
    <mirror>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
      <mirrorOf>m.g.o-public</mirrorOf>
    </mirror>
  </mirrors>

I can avoid the issue by changing my ~/.m2/settings.xml file to use the following mirror definition instead:

  <mirrors>
    <mirror>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
      <mirrorOf>*,!repo.jenkins-ci.org,!incrementals</mirrorOf>
    </mirror>
  </mirrors>

Other users have reported the same issue, including:

Expected results

I think that warnings about unresolvable dependencies in the extra enforcer rules should be consistent with the warnings in the rest of a maven build process.

@jglick
Copy link
Contributor

jglick commented Jul 20, 2022

Also reported as jenkinsci/jenkins#6875 (comment)

slawekjaranowski added a commit that referenced this issue Jul 20, 2022
we should use default remote repositories and repositories defined in project

Fix #225
@slawekjaranowski
Copy link
Member

By the way mirrorOf must contains id of repositories which you want to mirror ...
https://maven.apache.org/guides/mini/guide-mirror-settings.html

In provided project I see only repositories with id: central, incrementals, repo.jenkins-ci.org, there is no repository with id m.g.o-public, so your mirror configuration can't work

With definition

<mirrorOf>*,!repo.jenkins-ci.org,!incrementals</mirrorOf>

you mirror central repositories by https://repo.jenkins-ci.org/public/

For resolving artifact only center was used - I fixed it.

slawekjaranowski added a commit that referenced this issue Jul 21, 2022
we should use default remote repositories and repositories defined in project

Fix #225
slawekjaranowski added a commit that referenced this issue Jul 21, 2022
we should use default remote repositories and repositories defined in project

Fix #225
amottier added a commit to amottier/Waarp-All that referenced this issue Jul 4, 2023
Version 1.6.1 fix an issue related to remote repositories not interrogated (see mojohaus/extra-enforcer-rules#225).
Version 1.6.2 fix a similar issue: mojohaus/extra-enforcer-rules#231
So updating version from 1.6.0 to 1.6.2.

extra-enforcer-rules depends on maven-enforcer-plugin so updating also maven-enforcer-plugin to version 3.2.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants