<LongMessageWarning/>
I've been doing some thinking on this over the last couple of days in
'down time', so I'm posting them here for comment/laughter.
- I don't want project.xml to become an ant build file, i.e. it should
hold details about the project, not how it's built - that info is better
off in the build files and properties files.
- I'd like to define what is needed, e.g. jar, taglib-jar, war, portlet
par file, ear file etc in a flexible way and have some good defaults to
make it as little work as possible
- I'd like maven to be able to produce multiple 'outputs' from a build.
All from the same source and test tree.
If I define an output in the build as a jar, maven should run maven:jar.
If I define it as a war, it should run maven:war, ear runs maven:ear - how
do we make this flexible to be extended by the user, and still workable.
To make maven support multiple jars being built on a per project basis,
something needs to hold the fileset on a per jar basis, e.g. in maven's
case the fileset is:
<jar jarfile="${build.dir}/${final.name}.jar">
<!-- include classes -->
<fileset dir="${build.dest}" excludes="**/package.html" />
<!-- include jar resources -->
<fileset dir="${jarResources.baseDir}">
<patternset refid="jar.resources.set"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<!-- name should be '/' separated, not '.' -->
<section name="${package}">
<attribute name="Specification-Title" value="${id}"/>
<attribute name="Specification-Version"
value="${currentVersion}"/>
<attribute name="Specification-Vendor"
value="${organization}"/>
<attribute name="Implementation-Title" value="${package}"/>
<attribute name="Implementation-Version"
value="${currentVersion}"/>
<attribute name="Implementation-Vendor"
value="${organization}"/>
</section>
</manifest>
</jar>
It would be nice to be able to specify the filesets, and let the user
override them, e.g. we can specify something like this:
<jar jarfile="${build.dir}/${jar.name}.jar">
<!-- include classes -->
<fileset refid="jar.${jar.name}.classes" />
<!-- include jar resources -->
<fileset refid="jar.${jar.name}.resources" />
....
for a war that would be something like:
<war warfile="${build.dir}/${webapp.name}.war"
webxml="src/webapps/${webapp.name}/web/WEB-INF/web.xml">
<fileset refid="war.${webapp.name}.web"/>
<lib refid="war.${webapp.name}.lib" />
<classes refid="war.${webapp.name}.classes"/>
<webinf refid="war.${webapp.name}.webinf"/>
<metainf refid="war.${webapp.name}.metainf"/>
</war>
The idea being here that in project.xml, you would list your build
'deliverables' or outputs, and maven would call a target defined in
build-maven.xml to generate the output, passing in the appropriate jar
name, war name etc. And the user can override the filesets in their build
file as needs be. I'm not terribly sure if ant allows
overriding/referencing of filesets, but I'll be finding out soon.
So, in project.xml I'd define in the build section:
<outputs>
<output>
<result>jar</result>
<name>maven</name>
</output>
<output>
<result>jar</result>
<name>maven-cli</name>
</output>
<output>
<result>war</result>
<name>maven-web-gui</name>
</output>
<output>
<result>taglib</result>
<name>maven-jsp</name>
</output>
</outputs>
build-maven.xml would delegate to the appropriate build-QQQQ.xml file as
necessary, e.g. build-j2ee.xml or build-jetspeed.xml for the war, taglib,
jar etc types
Bring on the flames.../alternate designs :)
--
dIon Gillard, Multitask Consulting
Work: http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers