You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gg...@apache.org on 2023/03/15 12:26:38 UTC
[camel] branch main updated: [CAMEL-11767] Fix configuration of Maven repository policies
This is an automated email from the ASF dual-hosted git repository.
ggrzybek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 7d80fdd1b0a [CAMEL-11767] Fix configuration of Maven repository policies
7d80fdd1b0a is described below
commit 7d80fdd1b0a873f9e8eec5e287c35901ea35856e
Author: Grzegorz Grzybek <gr...@gmail.com>
AuthorDate: Wed Mar 15 13:26:21 2023 +0100
[CAMEL-11767] Fix configuration of Maven repository policies
---
.../apache/camel/tooling/maven/MavenDownloaderImpl.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenDownloaderImpl.java b/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenDownloaderImpl.java
index 77e0dc4d1b6..b7f5fde89b9 100644
--- a/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenDownloaderImpl.java
+++ b/tooling/camel-tooling-maven/src/main/java/org/apache/camel/tooling/maven/MavenDownloaderImpl.java
@@ -290,6 +290,8 @@ public class MavenDownloaderImpl extends ServiceSupport implements MavenDownload
repositorySystemSession = configureRepositorySystemSession(registry, systemProperties,
settings, new File(settings.getLocalRepository()));
+ defaultPolicy = fresh ? POLICY_FRESH : POLICY_DEFAULT;
+
// process repositories - both from settings.xml and from --repos option. All are subject to
// mirrorring and proxying (handled by org.eclipse.aether.RepositorySystem#newResolutionRepositories())
List<RemoteRepository> originalRepositories = configureDefaultRepositories(settings);
@@ -306,8 +308,6 @@ public class MavenDownloaderImpl extends ServiceSupport implements MavenDownload
apacheSnapshotsResolutionRepository = repositorySystem.newResolutionRepositories(repositorySystemSession,
Collections.singletonList(apacheSnapshotsRepository)).get(0);
}
-
- defaultPolicy = fresh ? POLICY_FRESH : POLICY_DEFAULT;
}
@Override
@@ -1131,18 +1131,26 @@ public class MavenDownloaderImpl extends ServiceSupport implements MavenDownload
// default (enabled) policy for releases
rb.setPolicy(defaultPolicy);
} else {
+ String updatePolicy = r.getReleases().getUpdatePolicy() == null
+ ? RepositoryPolicy.UPDATE_POLICY_DAILY : r.getReleases().getUpdatePolicy();
+ String checksumPolicy = r.getReleases().getChecksumPolicy() == null
+ ? RepositoryPolicy.CHECKSUM_POLICY_WARN : r.getReleases().getChecksumPolicy();
rb.setPolicy(new RepositoryPolicy(
r.getReleases().isEnabled(),
- r.getReleases().getUpdatePolicy(), r.getReleases().getChecksumPolicy()));
+ updatePolicy, checksumPolicy));
}
// if someone defines Apache snapshots repository, (s)he has to specify proper policy, sorry.
if (r.getSnapshots() == null) {
// default (disabled) policy for releases
rb.setSnapshotPolicy(POLICY_DISABLED);
} else {
+ String updatePolicy = r.getSnapshots().getUpdatePolicy() == null
+ ? RepositoryPolicy.UPDATE_POLICY_DAILY : r.getSnapshots().getUpdatePolicy();
+ String checksumPolicy = r.getSnapshots().getChecksumPolicy() == null
+ ? RepositoryPolicy.CHECKSUM_POLICY_WARN : r.getSnapshots().getChecksumPolicy();
rb.setSnapshotPolicy(new RepositoryPolicy(
r.getSnapshots().isEnabled(),
- r.getSnapshots().getUpdatePolicy(), r.getSnapshots().getChecksumPolicy()));
+ updatePolicy, checksumPolicy));
}
repositories.add(rb.build());
}