You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/10/20 15:19:44 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2474: Read mainClass configuration or property.

JaroslavTulach commented on a change in pull request #2474:
URL: https://github.com/apache/netbeans/pull/2474#discussion_r508598162



##########
File path: java/maven/src/org/netbeans/modules/maven/runjar/RunJarPrereqChecker.java
##########
@@ -99,6 +105,58 @@
         return true;
     }
 
+    private static String findMainClass(RunConfig config) {
+        // Read main class from the manifest property:
+        String mainClass = getConfiguration(config, "maven-jar-plugin", "archive", "manifest", "mainClass");

Review comment:
       maybe add `// NOI18N` as these texts shall never be localized.

##########
File path: java/maven/test/unit/src/org/netbeans/modules/maven/runjar/RunJarPrereqCheckerTest.java
##########
@@ -63,4 +69,103 @@ public void testWriteMapping() throws Exception {
         assertEquals(1, mapping.getActions().size());
     }
 
+    public void testMainClassManifest() throws Exception {
+        TestFileUtils.writeFile(d, "pom.xml",
+                "<project>\n" +
+                "    <modelVersion>4.0.0</modelVersion>\n" +
+                "    <groupId>testgrp</groupId>\n" +
+                "    <artifactId>testart</artifactId>\n" +
+                "    <version>1.0</version>\n" +
+                "    <build>\n" +
+                "        <plugins>\n" +
+                "            <plugin>\n" +
+                "                <groupId>org.apache.maven.plugins</groupId>\n" +
+                "                <artifactId>maven-jar-plugin</artifactId>\n" +
+                "                <configuration>\n" +
+                "                    <archive>\n" +
+                "                        <manifest>\n" +
+                "                            <mainClass>com.mycompany.Main2</mainClass>\n" +

Review comment:
       Does this also work with a property? E.g.  `<mainClass>${clazz}</mainClass>` - I assume it does, but it would be good to verify that.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists