In the grid group we have some very useful ant build files with multiple tasks for invoking various globus tools, auto-generating code stubs etc etc.Answer: You need a maven.xml file, as well as the project.xml file. The maven.xml is where you can specify new goals, and where you can add tasks to existing goals. It has similar syntax to an ant build.xml file - infact in here you can use standard ant tags. This file is described (all too briefly ) here: http://maven.apache.org/reference/user-guide.html#maven.xml the main different is that while ant has 'target' tags, maven has 'goal' tags, which are used to specify new goals. Even better, it has 'preGoal' and 'postGoal' tags, which are used to specify extra stuff to run before or after a goal.These tags are documented at http://wiki.codehaus.org/maven/WerkzTagDocumentation?action=highlight&value=preGoalHow I can tell maven to build the source using (eg) the "ant build" task (with all our specialised subtasks), rather than the standard maven build (which just tries to compile a limited subset of the source?). -- KonaAndrews
<?xml version="1.0" ?> <project xmlns:j="jelly:core" xmlns:maven="jelly:maven" default="jar:jar">This is the header - similar to the start of an ant script, but need to set up xml namespaces here for the different tag libraries you're using. - these two seem to be pretty standard. The default attribute gives the default goal to attain.
<preGoal name="java:compile"><!-- generate classes from schema first -->
<mkdir dir="${basedir}/generated/java" />
<path id="generated.src" location="${basedir}/generated/java"/>
<maven:addPath id="maven.compile.src.set" refid="generated.src"/> <!-- declares new src tree to maven -->
<attainGoal name="generate-delegate" />
</preGoal>
this adds a hook to the start of the java:compile goal. The tags without namespaces are standard ant tags. It makes a new directory for generated
code, adds this directory to the maven compile set (set of directories to build up), and then instructs maven to attain the goal 'generate-delegate' before starting the 'java:compile' goal.
<preGoal name="clean"> <!-- delete generated classes too-->
<delete dir="${basedir}/generated/java" />
</preGoal>
here's another hook - it makes sure the generated code gets cleaned up whenever the 'clean' goal is run
<goal name="generate-delegate" description="generate client classes from wsdl">
<taskdef resource="axis-tasks.properties" classpathref="maven.dependency.classpath" /> <!-- let ant know about this new task -->
<axis-wsdl2java
output="${basedir}/generated/java"
verbose="true"
noimports="true"
url="wsdl/AxisDataServer.wsdl">
<mapping
namespace="http://localhost:8080/axis/services/AxisDataServer"
package="org.astrogrid.datacenter.delegate.axisdataserver" />
</axis-wsdl2java>
</goal>
This is the definition of the goal that generates classes from the wsdl file for the DataCenter workgroup. (obviously you'd change this for your own needs). Axis provides a predefined ant-task to do the generation (ant-wsdl2java). However, as usual with ant, before we can call this external task, it has to be defined.
This task is implemented by classes in the axis-ant.jar. So if you add this to the project dependency list in project.xml, then you can be sure the jar will always be available, and present on the 'maven.dependency.classpath' The rest of this snippet is standard ant code.
Here's how you add the dependency on axis-ant.jar to the project.xml:
<dependency>
<groupId>axis</groupId>
<artifactId>axis-ant</artifactId>
<version>1.1</version>
</dependency>
I have a toplevel directory called ogsa, quite empty except for a subproject directory called ag-ogsa-echo (a complete, standalone sub-project with maven config files, etc).I think what you need is the 'multiproject' maven plugin. It's documented at http://maven.apache.org/reference/plugins/multiproject/index.html I've not used this, but it looks pretty straightforwards. For building on the astrogrid maven site, you'll need to add a hook to get it to run the multiproject goals as part of the build . something likeWould you know what to put in the ogsa directory to tell maven to pass any build goals (maven java:compile, maven jar etc) down to the sub-project directory and run them there?
The ultimate goal here might be a series of standalone sub-projects, with maven config in the parent directory just to build all the subprojects. -- KonaAndrews
<preGoal name="site"> <attainGoal name="multiproject:site" /> </preGoal>
<dependency>
<groupId>castor</groupId>
<artifactId>castor</artifactId>
<version>0.9.5</version>
<type>jar</type>
<url>http://www.castor.org/</url>
</dependency>
Can I get at the jar versions as a property in the build script ?
Reason is I want to do something like this ....
<copy verbose="true" todir="${axis.webapp}/WEB-INF/lib">
<fileset dir="${jar.cache.local}/castor/jars">
<include name="castor-${castor.version}.jar"/>
<include name="castor-${castor.version}-xml.jar"/>
</fileset>
....
</copy>
I need be specific about the versions because the local maven repository is shared between all projects, so it may contain different versions of the castor jars.
Note, I don't want to transfer all of the jars listed in the project.xml depends.
-- DaveMorris - 12 Nov 2003
Ok, solved it - UsefulMavenNotes#Access_to_individual_dependencie
-- DaveMorris - 13 Nov 2003
maven javadochttp://maven.apache.org/reference/plugins/javadoc/properties.html contains a list of the properties you can set to tweak the javadoc. Read http://java.sun.com/j2se/javadoc/writingdoccomments/
<packageGroups>
<packageGroup>
<title>Web Service Delegate - Public Interface</title>
<packages>org.astrogrid.jes.delegate</packages>
</packageGroup>
<packageGroup>
<title>Web Service Delegate - Implementation</title>
<packages>org.astrogrid.jes.delegate.impl</packages>
</packageGroup>
<packageGroup>
<title>Service Components Configuration</title>
<packages>org.astrogrid.jes.component*</packages>
</packageGroup>
<packageGroup>
<title>Job Store</title>
<packages>org.astrogrid.jes.job:org.astrogrid.jes.impl.workflow</packages>
</packageGroup>
<packageGroup>
<title>Scheduler</title>
<packages>org.astrogrid.jes.jobscheduler*</packages>
</packageGroup>
<packageGroup>
<title>Controller and Monitor</title>
<packages>org.astrogrid.jes.jobcontroller:org.astrogrid.jes.jobmonitor</packages>
</packageGroup>
</packageGroups>
<!-- define a destination for the generated documentation -->
<property name="webapp.docs" location="${basedir}/target/webapp-docs" />
<!-- hook our custom goals into the standard war goal -->
<preGoal name="war:war" >
<attainGoal name="site-webapp" />
<copy todir="${maven.build.dir}/${pom.artifactId}" overwrite="yes">
<fileset dir="${webapp.docs}" />
</copy>
</preGoal>
<goal name="site-webapp">
<echo> generating webapp site into ${webapp.docs}" </echo>
<!-- first merge two doc sets - site xdocs take precendence -->
<property name="tmp.docs" location="${basedir}/target/webapp-docs-src" />
<mkdir dir="${tmp.docs}" />
<copy todir="${tmp.docs}">
<fileset dir="${basedir}/site-xdocs" />
</copy>
<copy overwrite="false" todir="${tmp.docs}">
<fileset dir="${basedir}/xdocs" />
</copy>
<j:set var="maven.docs.dest" value="${webapp.docs}" />
<j:set var="maven.docs.src" value="${tmp.docs}" />
<j:set var="maven.xdoc.poweredby.title" value="Provided by Astrogrid" />
<j:set var="maven.xdoc.poweredby.url" value="http://www.astrogrid.org" />
<j:set var="maven.xdoc.poweredby.image" value="http://www.astrogrid.org/images/AGlogo" />
<mkdir dir="${webapp.docs}" />
<attainGoal name="site:generate" />
</goal>
This will generate a site documentation set, and copy it into the webapp folder before it is packaged into a war file.
TODO: find out how to run just a few of the site reports, rather than all of them.
![]() |
Click here for the AstroGrid Service Web |
This is the AstroGrid Development Wiki |
|