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

[JENKINS-64408] support targetPath property for webResources #208

Merged
merged 1 commit into from
Jan 21, 2021
Merged

[JENKINS-64408] support targetPath property for webResources #208

merged 1 commit into from
Jan 21, 2021

Conversation

sephiroth-j
Copy link
Member

  • 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.
    example: mvn -DskipTests=true -Dport=8081 clean compile hpi:hpi hpi:run

Please see JENKINS-64408 for the background and motivation of this.

- 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
@sephiroth-j
Copy link
Member Author

@timja , @oleg-nenashev: Do you have time to review this PR?

Copy link
Member

@oleg-nenashev oleg-nenashev left a 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

Copy link
Member

@timja timja left a 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

@oleg-nenashev oleg-nenashev merged commit 5d3d4cd into jenkinsci:master Jan 21, 2021
@daniel-beck
Copy link
Member

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.

@sephiroth-j
Copy link
Member Author

@daniel-beck: I was not familiar with those integration tests but I was able the add one that covers packaging webresources (#213).

@timja
Copy link
Member

timja commented Feb 22, 2022

This prevents live reloading of files in the webapp directory, see jenkinsci/theme-manager-plugin#75 (comment)

When running with mvn hpi:run

e.g. run this plugin:
https://github.com/jenkinsci/solarized-theme-plugin

Bump parent pom to 4.25

Run with mvn hpi:run
Configure the theme on system config page

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()));
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants