This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254777 - Save the "Main Class" as a property in Maven pom
Summary: Save the "Main Class" as a property in Maven pom
Status: NEW
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.1
Hardware: Macintosh Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Tomas Stupka
URL:
Keywords:
: 256193 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-27 10:34 UTC by navneet
Modified: 2017-05-24 10:52 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
IDE log (78.04 KB, text/plain)
2015-08-27 10:35 UTC, navneet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description navneet 2015-08-27 10:34:55 UTC
Product Version = NetBeans IDE 8.1 Beta (Build 201508041349)
Operating System = Mac OS X version 10.11 running on x86_64
Java; VM; Vendor = 1.8.0_51
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.51-b03

When working with jar projects, the maven jar plugin should save the main class as attribute in the manifest rather than in the nb projects.
Comment 1 navneet 2015-08-27 10:35:02 UTC
Created attachment 155685 [details]
IDE log
Comment 2 bugmenot1 2017-05-24 10:52:02 UTC
The POM could contain:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>org.example.MainApp</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

When running a project, NetBeans should get the main class from the created manifest (or read this plugin’s settings if NetBeans doesn’t execute the package phase).
Comment 3 bugmenot1 2017-05-24 10:52:19 UTC
*** Bug 256193 has been marked as a duplicate of this bug. ***