Multi Artifact main class problem

Dear Friends,
I am trying to create multi artifact in my project.Every artifacts have own and diffeent "Main class".
I created multi artifacts, but the problem is that all aritifacts assigned to single value.
when I set main class in artifact #1, other artifacts's #2, #3 's main class changed also!!!
All of them use single  MANIFEST.MF file and settings!!
what should I do?
Thanks

4 comments

Hello,

Main-class attribute is stored only in MANIFEST.MF file and isn't stored in IDEA settings. So if you want to use different main-class for different
artifacts you need to create several MANIFEST.MF files. After that for each artifact press 'Create directory' icon in the 'Output Layout' tree in the
artifact editor to create META-INF directory, then press '+' button, choose 'File' item and select an appropriate MANIFEST.MF file in the file chooser.

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Dear sir,
Thanks, I done as you said and defined 3 seperate "META-INF\MANIFEST_1.MF" and simillars for my 3 artifacts. I added them to tree also (replaced MF with std one).
After adding in bellow form, manifest properties block, the "manifest file :" entry gets gray and shows old(original) still "MANIFEST.MF".
and main class entry gets gray also  !!!!
After Build I get "no main manifest attribute, in CaptureExtract3.jar" error !!
I opened product jar and noticed that it contains 2 MF files in "META-INF" dir as "MANIFEST.MF" which contains many files as bellow


Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0-b64 (Sun Microsystems Inc.)

Name: org/jdom/filter/
......


and "META-INF\MANIFEST_1.MF" which contains as bellow


Manifest-Version: 1.0
Main-Class: CaptureExtract


it seems that my generated MF and compiler generated not mixed !!
I am using ver 11.1.3
Thanks

0

Looks like some modules or libraries added to the artifact have their own MANIFEST.MF files. In such cases IDEA doesn't merge these files and use the
firstly added file in the created jar. So you need to ensure that your MANIFEST.MF files will be the first items in the corresponding artifacts. To do
this, open an artifact editor, click on 'a->z' icon to tell the 'Output Layout' tree to show items in the order they are copied and not in sorted
order and use 'Move Up' icon to put your 'META-INF' directory to be the first sub-node under the jar node.

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Dear Friends,
I noticed That idea is sensitive to "MANIFEST.MF" file name and can't work (or properly) with other names.
What I do is, I created seperated "META-INF_xxxx" dir and defined seperate "MANIFEST.MF" files there.
And then use them in every related artifact
It works
Thanks for your help
Tarvirdi

0

Please sign in to leave a comment.