You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2018/09/28 16:46:29 UTC

[Bug 62772] New: Update JAR Task to Specify --main-class Parameter

https://bz.apache.org/bugzilla/show_bug.cgi?id=62772

            Bug ID: 62772
           Summary: Update JAR Task to Specify --main-class Parameter
           Product: Ant
           Version: 1.10.1
          Hardware: PC
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: Jeff.Gullett@raytheon.com
  Target Milestone: ---

In Java <=8, the main class within a JAR file was specified in the JAR
manifest.  Specifying such a class using the JAR task has the following syntax:

    <jar destfile="something.jar" basedir="release/dir">
        <manifest>
            <attribute name="Main-Class" value="fully.qualified.class.name" />
        </manifest>
    </jar>

This appears to be implemented by passing the `-m [MANIFEST_FILE]` option to
the JAR command (specifies a manifest file).  When creating modular JAR files
in Java >=9, the only way to specify the ModuleMainClass attribute is to add
the `-e fully.qualified.class.name` argument to the JAR command.

The current JAR task doesn't provide the capability to specify this
command-line option, so I am forced to manually call the JAR command using the
EXEC task instead.  Add functionality to supply a `-e` argument to the JAR
command from the JAR task definition.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62772] Update JAR Task to Specify --main-class Parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62772

Bruce Alspaugh <al...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alspaughb@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62772] Update JAR Task to Specify --main-class Parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62772

--- Comment #2 from Jan Mat <ja...@materne.de> ---
See also my comment to --module-version bug-entry
https://bz.apache.org/bugzilla/show_bug.cgi?id=62789#c1

The content of the compiled module-info.class has to be changed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62772] Update JAR Task to Specify --main-class Parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62772

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
Actually Ant does not use the command line jar tool at all, it creates the
archive and the MANIFEST.MF inside of it all by itself.

So what needs to be changed in Ant is to mimic the effect of --main-class in
the generated ZIP we call a jar. Without having looked into it in detail this
likely means we need to tinker with the mudule-info.java file.

-- 
You are receiving this mail because:
You are the assignee for the bug.