diff options
author | gjoranv <gv@oath.com> | 2018-07-23 16:54:18 +0200 |
---|---|---|
committer | gjoranv <gv@oath.com> | 2018-07-23 16:54:18 +0200 |
commit | fe50f38a087cf53094f5dec4fa1cf22d0bc2c879 (patch) | |
tree | 18729d5f4bec36d8667952e89e4796735cc958af /bundle-plugin | |
parent | a2b96031d9dd0df98169ad3d2ad6ce3b1710eefc (diff) |
Add option to attach the bundle to the artifact.
Diffstat (limited to 'bundle-plugin')
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java index b5fac517c9d..30ffc54225f 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java @@ -9,10 +9,12 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Build; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectHelper; import org.codehaus.plexus.archiver.jar.JarArchiver; import java.io.File; @@ -37,6 +39,9 @@ public class AssembleContainerPluginMojo extends AbstractMojo { @Parameter(defaultValue = "${project}") private MavenProject project = null; + @Component + private MavenProjectHelper projectHelper; + @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session = null; @@ -46,6 +51,12 @@ public class AssembleContainerPluginMojo extends AbstractMojo { @Parameter(alias = "UseCommonAssemblyIds", defaultValue = "false") private boolean useCommonAssemblyIds = false; + @Parameter(alias = "AttachBundle", defaultValue = "false") + private boolean attachBundleToArtifact; + + @Parameter(alias = "BundleClassifier", defaultValue = "bundle") + private String bundleClassifierName; + @Override public void execute() throws MojoExecutionException { Map<Dependencies, String> jarSuffixes = new EnumMap<Dependencies, String>(Dependencies.class); @@ -76,6 +87,13 @@ public class AssembleContainerPluginMojo extends AbstractMojo { addClassesDirectory(jarWithDependencies); addDependencies(jarWithDependencies); createArchive(jarFiles.get(Dependencies.WITH), jarWithDependencies); + + if (attachBundleToArtifact) { + projectHelper.attachArtifact(project, + project.getArtifact().getType(), + bundleClassifierName, + jarFiles.get(Dependencies.WITH)); + } } private File jarFileInBuildDirectory(String name, String suffix) { |