On 10/19/06, Lars Monsees <[EMAIL PROTECTED]> wrote:
>> -----Ursprüngliche Nachricht-----
>> Von: Lars Monsees [mailto:[EMAIL PROTECTED]
>> Gesendet: Donnerstag, 19. Oktober 2006 09:35
>> An: [email protected]
>> 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.

It is in the documentation of 1.7.

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.

google manifest classpath
finds a number entries - including a task from hivemind (manifestclasspath)
and a jguru entry which goes tru the full procedure using ant 1.6.

google manifestclasspath
finds the new ant 1.7 task (manifestclasspath)

Peter



Lars


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to