Hi,

 

I just tried to make a target "jar" for generating a jar file. Because this jar file needs some specific manifest information to run properly I have to add a manifest file. How it's possible to create such a manifest file within the build file ? The first possibility I tried out is to make a propertyfile tag but somehow it doesn't work.

 

Example code:

 

<target name="jar" depends="build">

  <jar jarfile="Application.jar" basedir="${Dest}" manifest="./Manifest.mf"/>

</target>

 

 

The better possibility for me is to create an own task that will generate a manifest file in a specific directory. I watched the documentation and found a standard example for doing this:

 

package com.mydomain;
 
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
 
public class MyVeryOwnTask extends Task {
  private String msg;
 
  // The method executing the task
  public void execute() throws BuildException {
    System.out.println(msg);
  }
 
  // The setter for the "message" attribute
  public void setMessage(String msg) {
    this.msg = msg;
}
}
 
The task can then very easy used for own purposes by implementing the following lines in the build.xml.
 
 
<project name="OwnTaskExample" default="main" basedir=".">
  <taskdef name="mytask" classname="com.mydomain.MyVeryOwnTask"/>
 
  <target name="main">
    <mytask message="Hello World! MyVeryOwnTask works!"/>
  </target>
</project>
 
But !
 
I found not out how it's possible to make a getter for a different type than String. How it's possible to make a getter- method for an array or a string list. Is there somebody able to give me an answer ?

 


 

Thomas Kerle

 E-mail : [EMAIL PROTECTED]

 

 

Reply via email to