Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jun 2000 15:10:54 +0200
From:      Ernst de Haan <ernst@jollem.com>
To:        Cliff Rowley <cliff@olive.co.uk>
Cc:        freebsd-java@freebsd.org
Subject:   Re: Odd request
Message-ID:  <20000616151054.A39818@c187104187.telekabel.chello.nl>
In-Reply-To: <394A24C8.24697B1B@olive.co.uk>; from cliff@olive.co.uk on Fri, Jun 16, 2000 at 01:59:52PM %2B0100
References:  <394A24C8.24697B1B@olive.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Cliff,


Try ant. It is easier than makefiles, and specifically designed for Java
projects. It works as follows:

Instead of a Makefile, you write an XML file that describes targets, you
usually call this file build.xml. The targets typically similar to the
following:

   <target name="classes">
      <javac srcdir="src/java" destdir="lib/classes">
   </target>

   <target name="all" depends="classes,javadoc" />

For a complete example see:

* Orion Primer
  http://www.orionserver.com/

Ant is an Apache project.

* Ant Homepage
  http://jakarta.apache.org/ant/

Good luck, and let me know if you run into trouble. Note that you should
use patchset 9 (not 8 or before) with Ant. And the Linux JDK is known to
cause trouble with Ant at times (creating directories with special
symbols in it).


Ernst


Cliff Rowley wrote:
> Perhaps an odd request, but could someone help me with a Makefile for
> compiling a java project?  As it stands, I'm using a shell script to do
> it for me, but it means we have to clean every time to ensure
> dependencies are built.  I'm not too hot with makefiles (yet), and this
> one isn't that straight forward, since 2 of the classes auto generate
> some of the other classes.
> 
> I've attached the current script.
> 
> Basically this is the chain of events that needs to happen:
> 
> 1.  The 2 code generation classes need to be compiled
> (WopFileCreate.java and WopFileData.java).
> 
> 2.  'java WopFileCreate > .p42i.properties' must be run to produce the
> output files and the properties file.
> 
> 3.  The rest of the .java files need to be compiled.
> 
> Seems quite simple I guess, but I cant get it going at all.
> 
> Many thanks.
> -- 
> Cliff Rowley
> Software Engineer
> Olive Systems LTD
> http://www.olive.co.uk
> #!/bin/sh
> #
> # Modified make utility
> #
> # Arguments:
> #    ./make                [ clean then make everything ]
> #    ./make clean          [ clean ]
> #    ./make runv           [ run system against Vax ]
> #    ./make runt           [ run system against transact ]
> 
> if [ "x$1" = "xclean" ]; then
>   echo Cleaning...
>   rm *.class
>   rm WopCcpdoc.java WopCcpdocSql.java WopCcpdocVax.java WopEvrEvent.java WopEvrEventSql.java WopEvrEventVax.java WopMemdoc.java WopMemdocSql.java WopMemdocVax.java WopMemfmy.java WopMemfmySql.java WopMemfmyVax.java WopMemmst.java WopMemmstSql.java WopMemmstVax.java
> elif [ "x$1" = "xrunv" ]; then
>   echo Running against Vax
>   java -Djava.compiler=none WopMain Vax
> elif [ "x$1" = "xrunt" ]; then
>   echo Running against Transact
>   java -Djava.compiler=none WopMain Transact
> elif [ "x$1" = "x" ]; then
>   echo Building...
>   START=`date`
> 
>   `$0 clean`
> 
>   echo Compiling exception classes...
>   javac *Exception*.java
> 
>   echo Compiling code generation classes...
>   javac WopFileCreate.java
>   javac WopFileData.java
> 
>   echo Auto generating classes...
>   java WopFileCreate > .p42i.properties
> 
>   echo Compiling auto generated classes...
>   javac *.java
> 
>   END=`date`
> 
>   echo
>   echo Build started  $START
>   echo Build finished $END
>   echo
> else
>   echo Invalid argument: $1
>   exit 1;
> fi



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000616151054.A39818>