[CMake] [Java] - Adding manifest information to a jar file

Nicolas Desprès nicolas.despres at gmail.com
Tue Feb 7 10:20:07 EST 2012


On Sat, Dec 10, 2011 at 3:46 PM, Andreas Schneider <asn at cryptomilk.org> wrote:
> On Saturday 29 October 2011 23:34:50 Frank Glinka wrote:
>> Hi,
>
> Hi,

Hi,

>
>> I am happy about the recently improved Java support within cmake.
>> Thanks! Anyhow, I have a small point which should be easy to improve and
>> which would deliver quite some usability, in my opinion.
>>
>> The current syntax for building and packaging Java files is:
>> > add_jar(${TARGETNAME} ${SOURCE_FILES} ${RESOURCE_FILES})
>>
>> This has some drawbacks:
>>
>> 1) No executable jar can be created with that method. It seems there is
>> already some effort on that issue as:
>> https://github.com/viandfraich/CMake/commit/36b223e34f5d48339da39e833a2f5e7d
>> f2866e87
>
> I don't like the way how it has been added here. I think it should be an
> optional vairable you set before like the others. Please open a feature
> request in the bug tracker. Patches are welcome.
>

Here is a proposal: https://github.com/polrop/CMake/commits/java-executable-jar

>> 2) A jar file can be annotated with a lot of more important information,
>> e.g., version information, scope, main-class (would also catch the first
>> issue), etc. This information is normally passed as a property/manifest
>> file when calling the "jar" packager. Currently, the UseJava.cmake
>>
>> module creates the following command within 'add_jar':
>> > jar cf ${TARGETNAME} ${CLASS_FILES} ${RESOURCE_FILES}
>>
>> The following would solve my (and I guess many others') use cases:
>> > jar cmf ${TARGETNAME} MyManifest.mf ${CLASS_FILES} ${RESOURCE_FILES}
>
> Should be an optional option and should be done like the other options.
>
> set(CMAKE_JAVA_MANIFEST mymanifest.mf)
> add_jar(foo foo.java)
>

I don't have any patch for this issue yet. Maybe in the future.

>> An optional command to add_jar would be desirable which allows to
>> provide an optional manifest file. If provided, the later syntax should
>> be used for calling the 'jar' tool.
>>
>> Will there be progress towards supporting manifest information anytime
>> soon within cmake?
>
> Open a feature request in the bugtracker.
>

Please tell me what you think about the proposal.

Regards,

-- 
Nicolas Desprès


More information about the CMake mailing list