[java-mvn-enforcer] branch main updated: Allow <jarPaths> to not exist.
Rod Widdowson
rdw at steadingsoftware.com
Tue Sep 28 13:40:11 UTC 2021
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-mvn-enforcer.
View the commit online:
http://git.shibboleth.net/view/?p=java-mvn-enforcer.git;a=commit;h=3338b1294f78c2dc5a9d2759478d93f44b1e9d52
The following commit(s) were added to refs/heads/main by this push:
new 3338b12 Allow <jarPaths> to not exist.
3338b12 is described below
commit 3338b1294f78c2dc5a9d2759478d93f44b1e9d52
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Sep 28 14:38:11 2021 +0100
Allow <jarPaths> to not exist.
After discussion and reflection, we want to complain, but allow jarPaths
as specified to not exist. This aligns with how the maven assembler works.
---
.../shibboleth/mvn/enforcer/impl/JarEnforcer.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java b/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
index 169c880..44d53e0 100644
--- a/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
+++ b/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
@@ -100,7 +100,12 @@ public class JarEnforcer implements EnforcerRule, MavenLoader{
final List<Path> jarPaths = new ArrayList<>();
for (final String name: StringSupport.stringToList(jarDirs, XMLConstants.LIST_DELIMITERS)) {
- jarPaths.add(checkDirPath(name));
+ final Path result = Path.of(name);
+ if (Files.notExists(result) || !Files.isDirectory(result)) {
+ log.warn("Directory " + name + " does not exist or is not a directory");
+ } else {
+ jarPaths.add(result);
+ }
}
if (jarPaths.isEmpty()) {
throw new EnforcerRuleException("No <jarsDirs/> provided");
@@ -114,7 +119,10 @@ public class JarEnforcer implements EnforcerRule, MavenLoader{
if (artifactFactory == null || artifactResolver == null || session == null || project == null) {
throw new EnforcerRuleException("Could not set up artifact environment");
}
- final Path pom = checkDirPath(parentPomDir).resolve("pom.xml");
+ final Path pom = Path.of(parentPomDir).resolve("pom.xml");
+ if (Files.notExists(pom)) {
+ throw new EnforcerRuleException("Pom File " + parentPomDir + "/pom.xml does not exist");
+ }
final Path tmp = Files.createTempDirectory("EnforcerCLI");
final Path map;
if (artifactMap != null && !artifactMap.isEmpty()) {
@@ -192,14 +200,6 @@ public class JarEnforcer implements EnforcerRule, MavenLoader{
return false;
}
- private static Path checkDirPath(final String s) throws EnforcerRuleException {
- final Path result = Path.of(s);
- if (Files.notExists(result) || !Files.isDirectory(result)) {
- throw new EnforcerRuleException("Directory " + s + " does not exists or is not a directory");
- }
- return result;
- }
-
/** {@inheritDoc} */
public Path downloadArtifact(final PomArtifact artifact, final String type) throws Exception {
final Artifact mavenArtifact = artifactFactory.createArtifact(artifact.getGroupId(),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list