ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: build.xml jar target problem
Date Tue, 08 Jul 2003 10:59:29 GMT
A few things:
- nice documented and indented build file :-)
- I cannot see an error. Does the created jar contains that
  file? (Exactly /no/uio/labmed/InterGene.class)?
- tip 1: use one <fileset> for *.class and *.gif. Should be faster.
  (comma separated pattern or nested <include>s)
- tip 2: store the main class in a property, so you can change
  that easier
- tip 3: use the 'description' attribute in the important targets
  (I think: build, dist and clean maybe javadoc and jar)
- tip 4: insert a 'run' target which starts your application (<java>).
  So you can easily start the app from inside the build environment.
- info: you don┬┤t have to use ${basedir} (e.g. on setting 'src' 
  property). Relative paths are resolved in relation to ${basedir}
  by default. But you can write it if you want

Ok, back to the problem (see No.2): contains the jar that file?


Jan


> -----Urspr├╝ngliche Nachricht-----
> Von: Karin Lagesen [mailto:karin.lagesen@labmed.uio.no]
> Gesendet am: Dienstag, 8. Juli 2003 12:44
> An: user@ant.apache.org
> Betreff: build.xml jar target problem
> 
> I am sorry if the problem I am having is not an ant problem, but I
> thought I'd try here anyway...:)
> 
> I use ant to make my manifest file when making jar files. The produced
> manifest file seems ok, I cannot run the jar file.
> 
> Manifest file produced:
> 
> Manifest-Version: 1.0
> Created-By: Apache Ant 1.5.1
> Built-By: karinlag
> Main-Class: no.uio.labmed.InterGene
> 
> 
> The error I get when I try to run the jar file:
> 
> uracil:10:39> java -jar dist/jar/InterGene.20030708.jar
> no.uio.labmed.InterGene
> Exception in thread "main" java.lang.NoClassDefFoundError:
> no/uio/labmed/InterGe
> ne
> 
> My build file (sorry if this message gets large...)
> 
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <project name="InterGene" default="build">
> 
>   <!-- URL to Java 2 API documentation --> 
>   <property name="apiurl" 
> value="http://java.sun.com/products/jdk/1.4/docs/api"/> 
> 
>   <!-- Directories -->
>   <property name="src"          value="${basedir}/src"/>     
> <!-- Source -->
>   <property name="lib"          value="${basedir}/lib"/>     
> <!-- External packages/jar files -->
>   <property name="build"        value="${basedir}/build"/>   
> <!-- Build directory -->
>   <property name="classes"      value="${build}/classes"/>   
> <!-- Compiled source files -->
>   <property name="doc"          value="${basedir}/doc"/>     
> <!-- Documentation -->
>   <property name="javadoc"      value="${doc}/javadoc"/>     
> <!-- Javadoc documentation -->
>   <property name="dist"         value="${basedir}/dist"/>    
> <!-- Distro = jar, source and doc -->
>   <property name="jar"          value="${dist}/jar"/>        
> <!-- Jar file directory -->
> 
>   
>   <!-- Initialization -->
>   <target name="init">
>     <tstamp/>
>     <mkdir dir="${build}"/>
>     <mkdir dir="${classes}"/>
>     <mkdir dir="${doc}"/>
>     <mkdir dir="${javadoc}"/>
>     <mkdir dir="${dist}"/>
>     <mkdir dir="${jar}"/>
>   </target>
> 
>   <!-- Copy icons -->
>   <target name="icons" depends="init">
>     <copy todir="${build}/icons">
>       <fileset dir="${basedir}" includes="icons/*.gif"/>
>     </copy>
>   </target>
>   
>   <!-- Build all classes -->
>   <target name="build" depends="init,icons">
>      <javac srcdir="${src}" destdir="${classes}"/>
>   </target>
> 
> 
>   <!-- Build documentation -->
>   <target name="javadoc" depends="init">
>     <javadoc sourcepath="${src}" destdir="${javadoc}"
>       access="public"
>       packagenames="no.uio.labmed.*">
>       <link href="${apiurl}"/>
>     </javadoc>
>   </target> 
> 
>   <!-- Build jar file -->
>   <target name="jar" depends="init,icons,build">
>     <jar jarfile="${jar}/${ant.project.name}.${DSTAMP}.jar">
>       <manifest>
>         <attribute name="Built-By" value="${user.name}"/>
>         <attribute name="Main-Class" value="no.uio.labmed.InterGene"/>
>       </manifest>
>       <fileset dir="${build}" includes="**/*.class"/>
>       <fileset dir="${build}" includes="**/*.gif"/>
>     </jar>
>   </target>
> 
>   <!-- Build distro -->
>   <target name="dist" depends="init,icons,build,javadoc,jar">
>     <copy todir="${dist}/javadoc">
>       <fileset dir="${javadoc}" includes="**/*"/>
>     </copy>
>   </target>
> 
>   <!-- Clean up -->
>   <target name="clean">
>     <delete dir="${build}"/>
>     <delete dir="${doc}"/>
>     <delete dir="${dist}"/>
>   </target>
> 
> </project>
> 
> TIA,
>  
> Karin
> -- 
> Karin Lagesen, PhD student
> karin.lagesen@labmed.uio.no
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message