[java-mvn-enforcer] 02/04: Log names are relative to ${basename}
Rod Widdowson
rdw at steadingsoftware.com
Fri Sep 24 15:39:05 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=c3060f660f6c32c4934036ced93c61346cc32fde
commit c3060f660f6c32c4934036ced93c61346cc32fde
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Sep 24 16:24:54 2021 +0100
Log names are relative to ${basename}
The nightly builds run maven from the top level dir (-f idp-parent/pom.xml).
The code still believed it would only ever be run from idp-distribution.
Relativize the log locations to ${basename}
Fix the error reported when basness occurs as well.
---
src/main/java/net/shibboleth/idp/enforcer/impl/IdPEnforcer.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main/java/net/shibboleth/idp/enforcer/impl/IdPEnforcer.java b/src/main/java/net/shibboleth/idp/enforcer/impl/IdPEnforcer.java
index 9b65a77..0d421ed 100644
--- a/src/main/java/net/shibboleth/idp/enforcer/impl/IdPEnforcer.java
+++ b/src/main/java/net/shibboleth/idp/enforcer/impl/IdPEnforcer.java
@@ -107,6 +107,7 @@ public class IdPEnforcer implements EnforcerRule, MavenLoader{
artifactResolver = helper.getComponent(ArtifactResolver.class);
session = (MavenSession) helper.evaluate( "${session}" );
project = (MavenProject) helper.evaluate( "${project}" );
+ final Path target = Path.of(helper.evaluate( "${basedir}" ).toString()).resolve("target");
if (artifactFactory == null || artifactResolver == null || session == null || project == null) {
throw new EnforcerRuleException("Could not set up artifact environment");
}
@@ -121,7 +122,7 @@ public class IdPEnforcer implements EnforcerRule, MavenLoader{
pomContext.initialize(pom);
boolean depdendencyResult = true;
if (checkDependencies) {
- final File out = new File("target/dependencyReport.txt");
+ final File out = target.resolve("dependencyReport.txt").toFile();
try (final PrintWriter report = new PrintWriter(
new BufferedOutputStream(new FileOutputStream(out)))) {
report.format("POM based Dependency Testing started at %s\n\n", Instant.now().toString());
@@ -137,7 +138,7 @@ public class IdPEnforcer implements EnforcerRule, MavenLoader{
boolean signatureResult = true;
if (checkSignatures) {
- final File out = new File("target/signatureReport.txt");
+ final File out = target.resolve("signatureReport.txt").toFile();
try (final PrintWriter report =
new PrintWriter(new BufferedOutputStream(new FileOutputStream(out)))) {
report.format("Signature Testing started at %s\n\n", Instant.now().toString());
@@ -161,7 +162,7 @@ public class IdPEnforcer implements EnforcerRule, MavenLoader{
} catch (final EnforcerRuleException e) {
throw e;
} catch (final Exception e) {
- throw new EnforcerRuleException("Could not run IdPEnforcer", e);
+ throw new EnforcerRuleException(e.toString() + " "+ e.getMessage(), e);
}
}
// Checkstyle: CyclomaticComplexity|MethodLength ON
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list