Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Developers List »

JavaFront update: TagBuilder

Stefan Bodewig

2008-10-30

Replies: Find Java Web Hosting

Author LoginPost Reply
just committed what could be the initial version for a fluent builder:

$ cat src/etc/examples/Simple3.java
package org.example;

import org.apache.ant.javafront.annotations.AntProject;
import org.apache.ant.javafront.annotations.AntTarget;
import org.apache.tools.ant.Project;
import org.apache.ant.javafront.builder.TagBuilder;

@AntProject(Name="simple3", BaseDir="..", DefaultTarget="hello")
public class Simple3 {
  private Project p;

  public void setProject(Project p) {
    this.p = p;
  }

  @AntTarget(Name="-setup")
  public void setup() {
    TagBuilder.forProject(p)
       .newProperty().withName("world").andValue("world").execute();
  }

  @AntTarget(Depends="-setup")
  public void hello() {
    TagBuilder.forProject(p)
       .newTag("echo")
       .withAttribute("message", "Hello, ${world}!")
       .execute();
  }
}
$ ant -lib build/lib/ant-javafront-0.1.jar -f src/etc/examples/Simple3.java
Buildfile: /home/stefan/dev/ASF/ant-javafront/src/etc/examples/Simple3.java

-setup:
ProjectHelper class org.apache.ant.javafront.helper.JavaFrontHelper can't parse Antlib descriptors, falling back to ProjectHelper2.

hello:
  [echo] Hello, world!

BUILD SUCCESSFUL
Total time: 0 seconds
$ ant -lib build/lib/ant-javafront-0.1.jar -f src/etc/examples/Simple3.java -Dworld=Welt
Buildfile: /home/stefan/dev/ASF/ant-javafront/src/etc/examples/Simple3.java

-setup:
ProjectHelper class org.apache.ant.javafront.helper.JavaFrontHelper can't parse Antlib descriptors, falling back to ProjectHelper2.

hello:
  [echo] Hello, Welt!

BUILD SUCCESSFUL
Total time: 0 seconds

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@(protected)
For additional commands, e-mail: dev-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.