[GitHub] [maven-jlink-plugin] bmarwell commented on a change in pull request #21: [MJLINK-53] Add classifier support

2020-12-06 Thread GitBox


bmarwell commented on a change in pull request #21:
URL: https://github.com/apache/maven-jlink-plugin/pull/21#discussion_r537139144



##
File path: src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
##
@@ -428,11 +437,13 @@ private JLinkExecutor getExecutor()
 return getJlinkExecutor();
 }
 
-private boolean projectHasAlreadySetAnArtifact()
+private boolean projectHasAlreadySetAnArtifact( File 
createZipArchiveFromImage )
 {
-if ( getProject().getArtifact().getFile() != null )
+Optional file = Optional.ofNullable( 
getProject().getArtifact().getFile() );

Review comment:
   Actually we're missing an `isFile` check here. Thanks for catching this





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [maven-jlink-plugin] bmarwell commented on a change in pull request #21: [MJLINK-53] Add classifier support

2020-12-06 Thread GitBox


bmarwell commented on a change in pull request #21:
URL: https://github.com/apache/maven-jlink-plugin/pull/21#discussion_r537135356



##
File path: src/it/projects/MJLINK-52_classifiers/invoker.properties
##
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+invoker.java.version = 1.9+

Review comment:
   That would require a toolchain for the test to be executed. This is why 
all the ITs are 1.9+.

##
File path: src/it/projects/MJLINK-52_classifiers/pom.xml
##
@@ -0,0 +1,59 @@
+
+
+
+http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;
+>
+  4.0.0
+  org.apache.maven.plugins
+  maven-jlink-plugin-mjlink-26
+  96.0
+  jlink
+  Maven
+  https://maven.apache.org
+  Test JLink creates archives with classifiers.
+  
+1.9
+1.9
+UTF-8
+  
+  
+
+  
+org.apache.maven.plugins
+maven-compiler-plugin
+3.8.0
+
+  1.9

Review comment:
   That would require a toolchain for the test to be executed. This is why 
all the ITs are 1.9+.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [maven-jlink-plugin] bmarwell commented on a change in pull request #21: [MJLINK-53] Add classifier support

2020-11-26 Thread GitBox


bmarwell commented on a change in pull request #21:
URL: https://github.com/apache/maven-jlink-plugin/pull/21#discussion_r531052492



##
File path: src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
##
@@ -428,11 +437,13 @@ private JLinkExecutor getExecutor()
 return getJlinkExecutor();
 }
 
-private boolean projectHasAlreadySetAnArtifact()
+private boolean projectHasAlreadySetAnArtifact( File 
createZipArchiveFromImage )
 {
-if ( getProject().getArtifact().getFile() != null )
+Optional file = Optional.ofNullable( 
getProject().getArtifact().getFile() );
+if ( file.isPresent() )
 {
-return getProject().getArtifact().getFile().isFile();
+File projectArtifact = file.orElseThrow( 
NoSuchElementException::new );
+return projectArtifact.getName().equals( 
createZipArchiveFromImage.getName() );

Review comment:
   I believe someone used a shortcut here and we need to iterate and check 
all of `getProject().getAttachedArtifacts()`.
   As I have never coded for classifier support, please take a look at these 
lines.
   
   `getArtifact()` sounds like the primary artifact. But the 
`maven-jlink-plugin` could also attach a zip file to a `packaging=jar` project 
as a secondary artifact, could it not?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org