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

integration test for extra warResources #450

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

jtnord
Copy link
Member

@jtnord jtnord commented Mar 15, 2023

IT in preparation for updating filtering code.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@jtnord jtnord added the chore label Mar 15, 2023
Comment on lines +66 to +67
<prop1>hello</prop1>
<prop2>goodbye</prop2>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 properties in the pom for filtering

Comment on lines +36 to +41
<webResources>
<resource>
<directory>${project.basedir}/src/main/webResource-filtering</directory>
<filtering>true</filtering>
</resource>
</webResources>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had no test coverage of this.

There appears to be only a few plugins webResources and fewer using filtering, but there could be closed source ones and this is publicly documented so leaving the functionallity for now.

// code uses plexus not maven so escapes are not supported.
assert globalConfigHelp.contains("\\\${prop1\\} hello");
assert globalConfigHelp.contains("\\@prop2\\@ goodbye");
// code claims to add System properties but this fails
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private Properties getBuildFilterProperties()
throws MojoExecutionException {
// System properties
Properties filterProperties = new Properties(System.getProperties());
// Project properties
filterProperties.putAll(project.getProperties());
for (String filter : filters) {
try {
Properties properties = PropertyUtils.loadProperties(new File(filter));
filterProperties.putAll(properties);
}
catch (IOException e) {
throw new MojoExecutionException("Error loading property file '" + filter + "'", e);
}
}
return filterProperties;
}

\@prop2\@ @prop2@
and these will be replaced at build time
it is even possible to use system properties
\@java.class.version\@ ${java.class.version}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly not the best system property to use...
java.vendor.url could be better and checking the replacement starts with https://

but as this currently does not work there is not much point in changing...

@jtnord jtnord requested a review from basil March 15, 2023 13:56
@jtnord jtnord merged commit a1733b7 into jenkinsci:master Mar 15, 2023
@jtnord jtnord deleted the plexus-cleanup-it branch March 15, 2023 16:23
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 this pull request may close these issues.

None yet

2 participants