This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
4 Replies Last post: Feb 26, 2013 10:34 AM by Moh Tarvirdi  
Moh Tarvirdi Newbie 8 posts since
Jul 5, 2011
Currently Being Moderated

Feb 25, 2013 3:13 PM

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

Guest
Currently Being Moderated
Feb 25, 2013 3:26 PM in response to: Moh Tarvirdi
Re: Multi Artifact main class problem

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!"

 

Guest
Currently Being Moderated
Feb 25, 2013 6:51 PM in response to: Moh Tarvirdi
Re: Multi Artifact main class problem

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!"

 

More Like This

  • Retrieving data ...