You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/09 15:27:35 UTC
[maven-jlink-plugin] 09/38: Added result image as archive to the
project so an mvn install/deploy now works.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
commit c81aff5d3cacaece4657dae8c3fed6b38ef8549f
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Jun 26 17:43:43 2017 +0000
Added result image as archive to the project so
an mvn install/deploy now works.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1799963 13f79535-47bb-0310-9956-ffa450edef68
---
.../META-INF/plexus/components.xml | 3 ---
.../maven/plugins/jlink/AbstractJLinkMojo.java | 1 +
.../org/apache/maven/plugins/jlink/JLinkMojo.java | 28 +++++++++++++++-------
3 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/main/filtered-resources/META-INF/plexus/components.xml b/src/main/filtered-resources/META-INF/plexus/components.xml
index 3a964b9..b98030d 100644
--- a/src/main/filtered-resources/META-INF/plexus/components.xml
+++ b/src/main/filtered-resources/META-INF/plexus/components.xml
@@ -31,7 +31,6 @@
<configuration>
<type>jlink</type>
<extension>zip</extension>
- <!-- Need to check the following? -->
<includesDependencies>true</includesDependencies>
<language>java</language>
<addedToClasspath>false</addedToClasspath>
@@ -59,8 +58,6 @@
<package>
org.apache.maven.plugins:maven-jlink-plugin:${project.version}:jlink
</package>
- <!-- What should be installed?
- JRE image in zip/tar format? -->
<install>
org.apache.maven.plugins:maven-install-plugin:2.5.2:install
</install>
diff --git a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
index 271e71a..d4540c5 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
@@ -251,6 +251,7 @@ public abstract class AbstractJLinkMojo
if ( tc == null )
{
+ // TODO: Check if we should make the type configurable?
tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
}
diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index 3b0ba15..1a3e9ed 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -204,7 +204,7 @@ public class JLinkMojo
private ArchiverManager manager;
/**
- * The kind of archive we should produce.
+ * The kind of archive we will produce.
*/
@Parameter( defaultValue = "zip", required = true )
private String archiveType;
@@ -246,7 +246,7 @@ public class JLinkMojo
failIfParametersAreNotInTheirValidValueRanges();
- deleteOutputDirectoryIfItAlreadyExists();
+ ifOutputDirectoryExistsDelteIt();
List<Dependency> dependencies = getSession().getCurrentProject().getDependencies();
@@ -284,13 +284,25 @@ public class JLinkMojo
File createZipArchiveFromImage = createZipArchiveFromImage( outputDirectory, outputDirectoryImage );
- // Set main artifact.
+ if ( projectHasAlreadySetAnArtifact() )
+ {
+ throw new MojoExecutionException( "You have to use a classifier "
+ + "to attach supplemental artifacts to the project instead of replacing them." );
+ }
+
getProject().getArtifact().setFile( createZipArchiveFromImage );
- // artifact.setFile( createZipArchiveFromImage );
- // getProject().setFile( createZipArchiveFromImage );
- // packaging is something different than type..
- // projectHelper.attachArtifact( getProject(), "image", "image", createZipArchiveFromImage );
+ }
+ private boolean projectHasAlreadySetAnArtifact()
+ {
+ if ( getProject().getArtifact().getFile() != null )
+ {
+ return getProject().getArtifact().getFile().isFile();
+ }
+ else
+ {
+ return false;
+ }
}
private File createZipArchiveFromImage( File outputDirectory, File outputDirectoryImage )
@@ -396,7 +408,7 @@ public class JLinkMojo
// }
}
- private void deleteOutputDirectoryIfItAlreadyExists()
+ private void ifOutputDirectoryExistsDelteIt()
throws MojoExecutionException
{
if ( outputDirectoryImage.exists() )
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.