Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Generate a "Makefile" for a Java project?
Generate a "Makefile" for a Java project? [message #168635] Wed, 14 July 2004 02:13 Go to next message
Eclipse UserFriend
Is there no way of generating any sort of "Makefile"-like setup (could be
Ant, I really don't care) for building java projects developed in Eclipse?
Using the Eclipse GUI to build the project is fine for development, but I
would like to be able to build a stable product from the command line, or
perhaps even on a machine without Eclipse installed on it. Much googling
has left me with no idea on how to do this. Is this possible?
Re: Generate a "Makefile" for a Java project? [message #168659 is a reply to message #168635] Wed, 14 July 2004 05:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: MarkusNospstieraam.yahoo.com

"Eric Camden" <adampauls@yahoo.ca> schrieb im Newsbeitrag
news:cd2iti$d71$1@eclipse.org...
> Is there no way of generating any sort of "Makefile"-like setup (could be
> Ant, I really don't care) for building java projects developed in Eclipse?
> Using the Eclipse GUI to build the project is fine for development, but I
> would like to be able to build a stable product from the command line, or
> perhaps even on a machine without Eclipse installed on it. Much googling
> has left me with no idea on how to do this. Is this possible?
>

I'd suppose you create an Ant Build Scipt for your project in Eclipse.
Steps:
-"New/File" in context menu of the project.
-Name it "build.xml" which is the registered for the Ant editor
-The Ant editor provides context sensitive code completion which allows you
to set up a new script from the scratch easily.
-You can test the script within eclipse with "Run/Ant Build"
-If you have finished your script you might use it from the command line
with the standalone Ant for Apache.org (just change to the directory which
contains your build.xml and type "ant"). Ant itself must be on the path.
-be sure that you don't rely on eclipse specific parameters in your script,
which are (of course) not available at commandline
-if you want to use the eclipse internal java compiler you must add the
appropriate -lib switch. Example:
C:\dev\myproject>c:\work\ant\bin\ant -lib
c:\Dev\eclipse3\plugins\org.eclipse.jdt.core_3.0.0.cheetah06 \jdtCompilerAdap
ter.jar -lib
c:\Dev\eclipse3\plugins\org.eclipse.jdt.core_3.0.0.cheetah06 \jdtcore.jar

Example build.xml:
<?xml version="1.0"?>

<!-- ============================================================ ==========

13.07.2004 13:42:17

project

description


============================================================ ========== -->

<project name="project" default="default">

<description>

description

</description>


<property name="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>



<!-- =================================

target: default

================================= -->

<target name="default" description="--> description">

<property name="src" value="${basedir}/src"/>

<property name="dst" value="${basedir}/bin"/>


<delete dir="${dst}"/>

<mkdir dir="${dst}"/>


<javac srcdir="${src}"

destdir="${dst}"

debug="on"

verbose="on"

source="1.5"

target="1.5">

</javac>

</target>



</project>
Re: Generate a "Makefile" for a Java project? [message #168698 is a reply to message #168635] Wed, 14 July 2004 11:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.rizzoweb.com

Eric Camden wrote:

> Is there no way of generating any sort of "Makefile"-like setup (could be
> Ant, I really don't care) for building java projects developed in Eclipse?
> Using the Eclipse GUI to build the project is fine for development, but I
> would like to be able to build a stable product from the command line, or
> perhaps even on a machine without Eclipse installed on it. Much googling
> has left me with no idea on how to do this. Is this possible?

You'll have to write your own for now (I think there is a feature
request for this in Bugzilla http://bugs/eclipse.org/bugs - if not, you
should create one).
Here is a nice Ant task that will help:
http://www.joeygibson.com/blog/tech/java/Ant/EclipseClasspat hTask.html
It automatically generates an Ant classpath based on your Eclipse
project's .classpath settings.

HTH,
Eric
Re: Generate a "Makefile" for a Java project? [message #168771 is a reply to message #168659] Wed, 14 July 2004 22:16 Go to previous message
Eclipse UserFriend
There is already an 8-month old bug in Eclipse, and I voted for it. It
really does surprise me that this doesn't exist already. I guess for now
I'll just have to learn to write Ant by hand.

Markus wrote:

> "Eric Camden" <adampauls@yahoo.ca> schrieb im Newsbeitrag
> news:cd2iti$d71$1@eclipse.org...
> > Is there no way of generating any sort of "Makefile"-like setup (could be
> > Ant, I really don't care) for building java projects developed in Eclipse?
> > Using the Eclipse GUI to build the project is fine for development, but I
> > would like to be able to build a stable product from the command line, or
> > perhaps even on a machine without Eclipse installed on it. Much googling
> > has left me with no idea on how to do this. Is this possible?
> >

> I'd suppose you create an Ant Build Scipt for your project in Eclipse.
> Steps:
> -"New/File" in context menu of the project.
> -Name it "build.xml" which is the registered for the Ant editor
> -The Ant editor provides context sensitive code completion which allows you
> to set up a new script from the scratch easily.
> -You can test the script within eclipse with "Run/Ant Build"
> -If you have finished your script you might use it from the command line
> with the standalone Ant for Apache.org (just change to the directory which
> contains your build.xml and type "ant"). Ant itself must be on the path.
> -be sure that you don't rely on eclipse specific parameters in your script,
> which are (of course) not available at commandline
> -if you want to use the eclipse internal java compiler you must add the
> appropriate -lib switch. Example:
> C:devmyproject>c:workantbinant -lib
> c:Deveclipse3pluginsorg.eclipse.jdt.core_3.0.0.cheetah06jdtC ompilerAdap
> ter.jar -lib
> c:Deveclipse3pluginsorg.eclipse.jdt.core_3.0.0.cheetah06jdtc ore.jar

> Example build.xml:
> <?xml version="1.0"?>

> <!-- ============================================================ ==========

> 13.07.2004 13:42:17

> project

> description


> ============================================================ ========== -->

> <project name="project" default="default">

> <description>

> description

> </description>


> <property name="build.compiler"
> value="org.eclipse.jdt.core.JDTCompilerAdapter"/>



> <!-- =================================

> target: default

> ================================= -->

> <target name="default" description="--> description">

> <property name="src" value="${basedir}/src"/>

> <property name="dst" value="${basedir}/bin"/>


> <delete dir="${dst}"/>

> <mkdir dir="${dst}"/>


> <javac srcdir="${src}"

> destdir="${dst}"

> debug="on"

> verbose="on"

> source="1.5"

> target="1.5">

> </javac>

> </target>



> </project>
Previous Topic:SWT Architecting question
Next Topic:blackberry
Goto Forum:
  


Current Time: Sun Jul 27 16:14:41 EDT 2025

Powered by FUDForum. Page generated in 0.03457 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top