Uploaded image for project: 'Maven JAR Plugin'
  1. Maven JAR Plugin
  2. MJAR-238

Allow setting of module main class

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java9 build 9+176, MacOS

      Description

      When a Java9 module is created using the maven-jar plugin, setting the manifest/mainclass does not set the module main class. Therefore the module is not executable without specifying the main class. Executing the module using java -m domain.app gives the following error:
      module jigsaw.app does not have a MainClass attribute

      According to the module specification a module (jar) can have a main class set. If I understand correctly it's inside the module-info.class as a property called ModuleMainClass

      When using the JDK9 jar command it will update the jar and the module-info.class.

        -e, --main-class=CLASSNAME The application entry point for stand-alone
                                   applications bundled into a modular, or executable,
                                   jar archive
      

      I guess it would make sense to have this as a separate configuration item since the mainclass entry in the manifest file is not needed in 'module mode' and vice versa.

      If this is a duplicate of another issue, please close this one, I couldn't find any existing issues related to this.

        Attachments

          Activity

            People

            • Assignee:
              eolivelli Enrico Olivelli
              Reporter:
              machielg Machiel Groeneveld
            • Votes:
              5 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m