[PJUG Javamail] Packaging Java Applications
Dan Colish
dan at unencrypted.org
Tue Aug 11 23:44:45 UTC 2009
Ok, I'm really close. My current build file will build correctly, but
now packaging is not quite right. :) I'll get it soon enough. Here's the
file inline.
--
--Dan
<project name="test4" basedir="." default="jar">
<property name="src.dir" value="src/"/>
<property name="classes.dir" value="classes/"/>
<property name="bin.dir" value="bin/"/>
<path id="project.classpath">
<fileset dir="lib" includes="**/*.jar"/>
</path>
<target name="clean">
<delete dir="classes/"/>
<delete file="MANIFEST.MF"/>
<delete file="test4.jar"/>
</target>
<target name="build" depends="clean">
<mkdir dir="${classes.dir}"/>
<javac srcdir="src" destdir="classes" debug="true"
debuglevel="source,lines,vars">
<classpath refid="project.classpath"/>
</javac>
</target>
<target name="jar" description="jars it up" depends="build">
<jar destfile="${ant.project.name}.jar" basedir="." includes="${classes.dir}/**/*.class,${project.classpath}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="usermenu.Menu"/>
</manifest>
</jar>
</target>
</project>
On Tue, Aug 11, 2009 at 03:46:58PM -0700, Kent Spaulding wrote:
> Ah, okay, I misunderstood.
>
> One option is Netbeans, which keeps its project files as ant files and
> they can simply be built via ant, without requiring the tools. ;-)
>
> Other than that, I simply put external libs into a <project-dir>/lib
> directory and then write an ant script that builds the project - testing
> it from outside eclipse. One of the ant targets creates a .zip that is
> the project to be distributed.
>
> --Kent
>
> On Aug 11, 2009, at 3:33 PM, Dan Colish wrote:
>
>> I'm really not that interested in a runable jar, thats pretty easy to
>> produce within eclipse. I'm trying to properly setup a java project
>> that
>> uses external libraries and builds correctly without requiring
>> eclipse.
>> My main concern is the directory structure for the project and any
>> build
>> files that are required. I have looked at the ant build.xml files, and
>> I
>> am working on that currently, but that is really complex. Even if I
>> can't do this without eclipse, I am confident there is a proper way to
>> do this that does not require an couple hours of setup. I've gotta be
>> doing something wrong here. The current project is a simple one, but I
>> would like to understand the correct way to do this for future
>> projects.
>>
>> --
>> --Dan
>>
>>
>>
>> On Tue, Aug 11, 2009 at 03:23:09PM -0700, Kent Spaulding wrote:
>>> Ant is one means - if all you care about is the executable then use
>>> eclipse's 'Runnable Jar' feature.
>>>
>>> For you project, click File|Export.. and in the treeview select as in
>>> the attached screenshot. It will allow you choose what to bundle.
>>>
>>> If your version of eclipse doesn't do this, there is a plugin called
>>> FatJar that will (which is where this feature came from)
>>>
>>> The resulting jar file is run as:
>>>
>>> java -jar myjar.jar <arguments>
>>>
>>> --Kent
>>>
>>
>>
>> _______________________________________________
>> Web Site - http://www.pjug.org/
>> Javamail mailing list
>> Javamail at pjug.org
>> http://www.pjug.org/mailman/listinfo/javamail
>
More information about the Javamail
mailing list