Skip to content

JSSD ANT Task

Andreas W. Bartels edited this page Dec 14, 2017 · 8 revisions

maven/build.xml

<?xml version="1.0"?>
<project name="maven" basedir=".." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  <property name="maven-ant-tasks.jar" value="lib/maven-ant-tasks-2.1.3.jar" />
  <path id="classpath.maven-ant-tasks">
    <pathelement location="${maven-ant-tasks.jar}" />
  </path>
  <typedef uri="antlib:org.apache.maven.artifact.ant" classpathref="classpath.maven-ant-tasks" />
</project>

jssc/build.xml

<?xml version="1.0"?>
<project name="jssc" basedir=".." xmlns:artifact="antlib:org.apache.maven.artifact.ant">

  <import file="maven/build.xml" />

  <artifact:dependencies pathId="jssc.class.path" settingsFile="${user.home}/.m2/settings.xml">
    <dependency groupId="net.anwiba.commons.tools" artifactId="anwiba-tools-definition-schema-json" version="1.0.76" />
  </artifact:dependencies>

  <macrodef name="jssc.generate">
    <attribute name="comment" />
    <attribute name="source" />
    <attribute name="package" />
    <attribute name="destination" />
    <sequential>
      <jssc source="@{source}" package="@{package}" comment="@{comment}" destination="@{destination}" />
    </sequential>
  </macrodef>

  <taskdef name="jssc" classname="net.anwiba.tools.definition.schema.json.generator.java.ant.JsonBeanGeneratorTask">
    <classpath>
      <path refid="jssc.class.path" />
    </classpath>
  </taskdef>

</project>

build.xml

<project basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">

  <import file="jssc/build.xml" />
  <import file="maven/build.xml" />

  :

  <target ... >
    :
    <jssc.generate comment="// Copyright (c) ${year} by Andreas W. Bartels"
                   source="src/main/schema"
                   package="net.anwiba.commons.json.schema.v1_0"
                   destination="src/main/java"
    />
  </target>

  :

</project>
Clone this wiki locally