ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Monsees" <l.mons...@atlantisgmbh.de>
Subject RE: Using path/refid for manifest classpath
Date Thu, 19 Oct 2006 09:55:29 GMT
>> -----Ursprüngliche Nachricht-----
>> Von: Lars Monsees [mailto:l.monsees@atlantisgmbh.de]
>> Gesendet: Donnerstag, 19. Oktober 2006 09:35
>> An: user@ant.apache.org
>> Betreff: Using path/refid for manifest classpath
>> 
>> Hello,
>> 
>> I just started using ANT within Eclipse. I have an application
>> that gets deployed as a JAR file.
>> To construct the classpath within the manifest, I first stated
>> all used libs manually in the build.xml but thought that there
>> has to be a better solution to this.
>> 
>> So, I now use a path that gets converted via pathconvert to
>> remove the preceding basedir (second "-->"). This works but
>> the manifest contains a backslash in the classpath:
>> "Class-Path: lib\app-shared-0.3.0.jar".
>> 
>> Here are parts of my build.xml:
>> 
>> 	<path id ="external.lib">
>> 		<fileset dir="${lib}">
>> 			<include name="**/*.jar"/>
>> 		</fileset>
>> 	</path>
>> 
>> 
>> 	<target name="compile" depends="init"
>> description="compile the source">
>> 		<buildnumber/>
>> 
>> 		<!-- Compile the java code from ${src} into ${build}
-->
>> -->		<javac srcdir="${src}" destdir="${build}"
>> classpathref="external.lib"/>
>> 	</target>
>> 
>> 
>> 	<target name="generateJAR" depends="compile"
>> description="generate the jarfile">
>> 
>> 		<pathconvert property="dingens" refid="external.lib">
>> 			<globmapper from="${basedir}\" to=""/>
>> 		</pathconvert>
>> 
>> 		<!-- Create the manifest -->
>> 		<manifest file="${jar.manifest}">
>> 
>> 			<attribute name="Built-By"
>> value="${user.name}"/>
>> 			<attribute name="Main-Class"
>> value="${jar.mainclass}"/>
>> 
>> -->			<attribute name="Class-Path"
>> value="${dingens}"/>
>> 		</manifest>
>> 		<!-- Put everything in ${build} into the jar file -->
>> 		<jar jarfile="${jar.file}" basedir="${build}"
>> manifest="${jar.manifest}"/>
>> 	</target>
>> 
>> 
>> 
>> Although the JAR works I would like to know if there is a
>> better way. I already searched with google, in the faqs and in the
>> wiki. 
>> 
>> 
>> Cheers
>> Lars


> For changing the backslash to slash, just set the dirsep-attribute
on
> pathconvert. 
> 

thx! 


> For a better way ... there was something DD said ... oh yes: the new
> (1.7) <manifestclasspath> task ... 

nice =)
Then I guess there is no need to state this in the documentation or
FAQ. 
btw: Is this problem not something common? Or can anyone give me some
best practice examples on how to create the manifest classpath
automatically? I´m just curious, ´cause I found nothing while
searching.

Lars


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message