-
Notifications
You must be signed in to change notification settings - Fork 89
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
[JENKINS-64408] support targetPath property for webResources #208
[JENKINS-64408] support targetPath property for webResources #208
Conversation
- it works for the packaging phase out of the box - for use as part of `hpi:run`, the goals `compile` and `hpi:hpi` must be executed before to ensure that `webappDirectory` exists. otherwise `warSourceDirectory` will be used as before. #JENKINS-64408
@timja , @oleg-nenashev: Do you have time to review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not tested but seems fine
Is a bit light on tests, is that something that could still be added? Otherwise I wouldn't be surprised if we manage to break this at the next opportunity. |
@daniel-beck: I was not familiar with those integration tests but I was able the add one that covers packaging webresources (#213). |
This prevents live reloading of files in the webapp directory, see jenkinsci/theme-manager-plugin#75 (comment) When running with e.g. run this plugin: Bump parent pom to 4.25 Run with Change a color, e.g. one in https://github.com/jenkinsci/solarized-theme-plugin/blob/master/src/main/webapp/solarized-dark.css#L3 Refresh the page. It will get updated. Bump parent pom to 4.26 (includes this change). Repeat above, file won't be live reloaded |
@@ -98,7 +97,12 @@ public void execute() throws MojoExecutionException, MojoFailureException { | |||
mainSection.addAttributeAndCheck(new Attribute("Libraries", StringUtils.join(paths, ","))); | |||
|
|||
// compute Resource-Path entry | |||
mainSection.addAttributeAndCheck(new Attribute("Resource-Path",warSourceDirectory.getAbsolutePath())); | |||
if (webappDirectory != null && webappDirectory.isDirectory()) { | |||
mainSection.addAttributeAndCheck(new Attribute("Resource-Path",webappDirectory.getAbsolutePath())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caused #299
This changed it from the source to target preventing live reload:
Before:
- WarSourceDir: /Users/timja/code/jenkins/solarized-theme-plugin/src/main/webapp
After:
- WebAppDir path: /Users/timja/code/jenkins/solarized-theme-plugin/target/solarized-theme
hpi:run
, the goalscompile
andhpi:hpi
must be executed before to ensure thatwebappDirectory
exists. otherwisewarSourceDirectory
will be used as before.example:
mvn -DskipTests=true -Dport=8081 clean compile hpi:hpi hpi:run
Please see JENKINS-64408 for the background and motivation of this.