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

Revert support targetPath property for webResources #300

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

51 changes: 0 additions & 51 deletions src/it/JENKINS-64408-packaged-webresources/pom.xml

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/it/JENKINS-64408-packaged-webresources/verify.groovy

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public abstract class AbstractHpiMojo extends AbstractJenkinsMojo {
* The directory where the webapp is built.
*/
@Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}")
protected File webappDirectory;
private File webappDirectory;

/**
* Single directory for extra files to include in the WAR.
Expand Down Expand Up @@ -420,17 +420,13 @@ public void copyResources(Resource resource, File webappDirectory, Properties fi
if (webappDirectory.exists()) {
String[] fileNames = getWarFiles(resource);
for (String fileName : fileNames) {
File targetDirectory = webappDirectory;
if (StringUtils.isNotBlank(resource.getTargetPath())) {
targetDirectory = new File(webappDirectory, resource.getTargetPath());
}
if (resource.isFiltering()) {
copyFilteredFile(new File(resource.getDirectory(), fileName),
new File(targetDirectory, fileName), null, getFilterWrappers(),
new File(webappDirectory, fileName), null, getFilterWrappers(),
filterProperties);
} else {
FileUtils.copyFileIfModified(new File(resource.getDirectory(), fileName),
new File(targetDirectory, fileName));
new File(webappDirectory, fileName));
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/jenkinsci/maven/plugins/hpi/HplMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
mainSection.addAttributeAndCheck(new Attribute("Libraries", String.join(",", paths)));

// compute Resource-Path entry
if (webappDirectory != null && webappDirectory.isDirectory()) {
mainSection.addAttributeAndCheck(new Attribute("Resource-Path",webappDirectory.getAbsolutePath()));
} else {
getLog().info("webappDirectory does not exist, will use warSourceDirectory");
mainSection.addAttributeAndCheck(new Attribute("Resource-Path",warSourceDirectory.getAbsolutePath()));
}
mainSection.addAttributeAndCheck(new Attribute("Resource-Path", warSourceDirectory.getAbsolutePath()));

mf.write(printWriter);
} catch (ManifestException | IOException e) {
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/org/jenkinsci/maven/plugins/hpi/RunMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ public class RunMojo extends AbstractJettyMojo {
@Parameter(defaultValue = "test")
protected String dependencyResolution;

/**
* The directory where the webapp is built.
*/
@Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}")
private File webappDirectory;

/**
* Single directory for extra files to include in the WAR.
*/
Expand Down Expand Up @@ -517,7 +511,6 @@ private void generateHpl() throws MojoExecutionException {
MojoExecutor.configuration(
MojoExecutor.element(MojoExecutor.name("jenkinsHome"), jenkinsHome.toString()),
MojoExecutor.element(MojoExecutor.name("pluginName"), project.getName()),
MojoExecutor.element(MojoExecutor.name("webappDirectory"), webappDirectory.toString()),
MojoExecutor.element(MojoExecutor.name("warSourceDirectory"), warSourceDirectory.toString()),
MojoExecutor.element(MojoExecutor.name("jenkinsCoreId"), jenkinsCoreId),
MojoExecutor.element(MojoExecutor.name("pluginFirstClassLoader"), Boolean.toString(pluginFirstClassLoader)),
Expand Down