facebook

Simple question regarding JAR creation

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #233667 Reply

    joefm1218
    Member

    Seems to be a very simple task, but one I can’t seem to figure out. How can I automatically generate a JAR file without using an Ant script?

    It seems the only mechanism is to use the export wizard to save a custom export configuration. Then, I have to manually right click on the *.jardesc file and hit ‘Create JAR’. Anyway to incorporate this task into the MyEclipse auto build process?

    I’m not in the business of creating ant scripts. Not really a fan of creating/maintaining a bunch of scripts that perform such simple tasks. Especially since the IDE understands how to create these files already.

    Is there something I’m missing here, or did the eclipse team purposely restrict this behavior for some weid reason? If so, I’d be curious of the rationale behind this decision.

    Thanks. And I apologize if this mechanism already exists and I just haven’t hit on it yet.

    #233681

    Scott Anderson
    Participant

    How can I automatically generate a JAR file without using an Ant script?

    A jar of what? Arbitrary files? A java project?

    If you’re trying to use automatically Jar a java project for use as a library by a Web Project, that’s covered in the Advanced section of the Working with Web Project quickstart, here: http://www.myeclipseide.com/images/tutorials/quickstarts/webprojects/

    If it’s something else, you’ll need to be more specific about what you’d like so we can tell if it’s supported.

    #234286

    I’m also confused despite reading the tutorial referenced above. I have checked the ‘jar dependent java project output’ checkbox in my web project preferences – is this supposed to turn classes in my web project ‘foo’ /WEB-INF/classes into /WEB-INF/lib/foo.jar when I deploy? Is my web project a ‘dependent’ java project by default?

    When the web project is deployed as either a packaged or exploded deployment I never get a jar file in /WEB-INF/lib when the deployment is completed – my classes are still in /WEB-INF/classes however so the deployment does work. I’m sure I’m doing something wrong but can’t figure it out. I’m using eclipse 3.1 on WinXP using a 5.0 SDK and 4.0M2 plugin.

    #234299

    Scott Anderson
    Participant

    I have checked the ‘jar dependent java project output’ checkbox in my web project preferences – is this supposed to turn classes in my web project ‘foo’ /WEB-INF/classes into /WEB-INF/lib/foo.jar when I deploy?

    No, it’s not. It’s intended to take any plain Java projects upon which your web project depends and jar *their* classes and place them in your WEB-INF/lib directory as a jar, so they’re available to your web project at runtime.

    I’m sure I’m doing something wrong but can’t figure it out.

    Actually, it sounds like deployment is is executing correctly. The Java classes within your web project should be placed in WEB-INF/classes, as per the spec. Are you experiencing an actually problem? Or, did you just not understand what was supposed to happen?

    #234374

    Hi Scott,

    I’m trying to have the WEB-INF/classes automatically jar’d to /WEB-INF/lib prior to a war generation/deployment. Since I can jar dependent projects I wanted to see if I could make this automcatic jar feature do this for me. Right now I have to go to the eclipse File/Export/Jarfile menu option to jar my classes to WEB-INF/lib before the war file gets created.

    #234392

    Scott Anderson
    Participant

    We won’t automatically jar classes that are in the web project simply because there’s no need, according to the spec. However, if you’d like that functionality about all I can suggest is moving all the Java code out to a dependent Java project and then setting your web project deployment settings to jar all dependent projects. That would do the trick.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Simple question regarding JAR creation

You must be logged in to post in the forum log in