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 182897 - -do-jar-with-libraries-without-manifest target does not add "Main-Class" entry to the manifest
Summary: -do-jar-with-libraries-without-manifest target does not add "Main-Class" entr...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-26 13:48 UTC by serge-d
Modified: 2011-02-07 14:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description serge-d 2010-03-26 13:48:05 UTC
If the project was created as "Java Class Library" in NetBeans 6.8 IDE the build process does not automatically add "Main-Class:" entry to the manifest. It's because "-do-jar-with-libraries-without-manifest" target of "build-impl.xml" ant script does not contain <attribute name="Main-Class" value="${main.class}"/> tag.
Comment 1 Tomas Zezula 2010-03-26 15:12:50 UTC
As a workaround for now you can set the manifest.file property pointing to manifest.mf (can be empty file).
Comment 2 Tomas Zezula 2010-03-29 15:40:41 UTC
Fixed in jet-main 0b5fcabeab6a
Comment 3 Jesse Glick 2010-03-30 14:52:35 UTC
I am backing this out in core-main #c9dc40614a25. It causes a test failure in BuildImplTest.testJar, and for good reason: when creating a new library project and building it, you get a manifest with

'Main-Class: '

which is nonsense. This attribute should only be set if there is in fact a main class.
Comment 4 Tomas Zezula 2010-03-30 14:59:59 UTC
>'Main-Class: '
>which is nonsense. This attribute should only be set if there is in fact a main class.
But this does not hurt anything and it's a more cleaner solution than the -do-jar-with-main-no-manifest, -do-jar-......
Unfortunately Ant is not designed for general build scripts and there is no other way than empty property or new target.
Comment 5 Jesse Glick 2010-03-31 03:57:54 UTC
(In reply to comment #4)
>> This attribute should only be set if there is in fact a main class.
> But this does not hurt anything

It's a very visible bug - every j2seproject without a main class would produce an incorrect manifest. I'm sure some other solution can be found.
Comment 6 Quality Engineering 2010-04-02 05:14:39 UTC
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c9dc40614a25
User: Jesse Glick <jglick@netbeans.org>
Log: Backed out changeset 0b5fcabeab6a from #182897.
Caused regression for projects which did not in fact have a main class.
Comment 7 Tomas Zezula 2011-02-07 14:53:37 UTC
Fixed jet-main 4c0bdd9bb167