Open gounthar opened 2 days ago
Maybe I'm mixing two things there... The detection of an old JDK may fail, but some remediation code may be the root cause:
/**
* If the plugin has HTTP repositories preventing modernization
*/
MAVEN_REPOSITORIES_HTTP(
(document, xpath) -> {
if (document == null) {
return false;
}
try {
Double nonHttpsRepositories = (Double) xpath.evaluate(
"count(//*[local-name()='project']/*[local-name()='repositories']/*[local-name()='repository']/*[local-name()='url' and not(starts-with(., 'https'))])",
document,
XPathConstants.NUMBER);
return nonHttpsRepositories != null && !nonHttpsRepositories.equals(0.0);
} catch (Exception e) {
return false;
}
},
plugin -> {
// TODO: Implement remediation function (See
// https://github.com/jenkinsci/plugin-modernizer-tool/pull/307)
return false;
},
"Found non-https repository URL in pom file preventing maven older than 3.8.1"),
I thought this was being handled by :
type: specs.openrewrite.org/v1beta/recipe
name: io.jenkins.tools.pluginmodernizer.MinimalBuildJava8
displayName: Minimal build for JDK 8
description: Ensuring a minimal build for a Jenkins plugin with JDK 8
tags: ['java8']
recipeList:
- org.openrewrite.maven.security.UseHttpsForRepositories
- org.openrewrite.jenkins.DisableLocalResolutionForParentPom
---
, but we may not even reach that recipe (see #307). 🤔
I think io.jenkins.tools.pluginmodernizer.MinimalBuildJava8
will need to be removed because it will not work if we don't have artifacts in the local maven cache
Must be done in a static way by implementing the TODOs (should not be too difficult)
I'm working on it. 🤗
Jenkins and plugins versions report
The AnchorChain plugin for example is not declaring any
java.version
property that could help us identify we need a remediation. It is declaring a parent pom version, though:The official documentation says:
Could we leverage that to treat the plugin as a pre-jdk8 plugin and remediate it?
What Operating System are you using (both controller, and any agents involved in the problem)?
WSL2/Debian
Reproduction steps
Expected Results
No error.
Actual Results
Anything else?
No response
Are you interested in contributing a fix?
Yes.