HHH-4763 Moved the metamodel task into build.xml and modified the antrun configuration to allow to run 'mvn antrun:run'. Also combined all antrun calls into one plugin configuration

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18446 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Hardy Ferentschik 2010-01-08 03:40:18 +00:00
parent 415c9e9ec3
commit c8e1fbddcf
2 changed files with 185 additions and 158 deletions

View File

@ -5,97 +5,119 @@
<project name="HibernateEntityManager" basedir="."> <project name="HibernateEntityManager" basedir=".">
<target name="packjar"> <target name="generate-metamodel" depends="uptodate.check" unless="metamodel.build.notRequired">
<property name="extension" value="jar"/>
<property name="packagename" value="${jarname}"/>
<property name="headerdirectory" value="."/>
<mkdir dir="${package.dir}"/>
<mkdir dir="${package.tmp.dir}/${headerdirectory}"/>
<copy todir="${package.tmp.dir}/${headerdirectory}">
<fileset dir="${classes.dir}">
<include name="**/test/pack/${packagename}/**.*"/>
</fileset>
</copy>
<jar destfile="${package.dir}/${jarname}.${extension}">
<fileset dir="${package.tmp.dir}">
<include name="**/*.*"/>
</fileset>
<fileset dir="${testresources.dir}/${jarname}">
<include name="**/*.*"/>
</fileset>
</jar>
<delete dir="${package.tmp.dir}"/>
</target>
<target name="packexploded"> <echo>Processing JPA annotations for metamodel generation</echo>
<property name="extension" value="jar"/> <javac srcdir="${src.dir}"
<mkdir dir="${package.dir}/${jarname}.${extension}"/> destdir="${target.dir}"
<copy todir="${package.dir}/${jarname}.${extension}"> failonerror="false"
<fileset dir="${classes.dir}"> fork="true"
<include name="**/test/pack/${jarname}/**.*"/> executable="${jdk16_home}/bin/javac"
</fileset> target="1.5"
<fileset dir="${testresources.dir}/${jarname}"> classpath="${classpath}">
<include name="**/*.*"/> <compilerarg value="-proc:only"/>
</fileset> </javac>
</copy> <touch file="${target.dir}/.staleflag"/>
</target> </target>
<target name="package" description="Prepare all needed jars and pars"> <target name="uptodate.check">
<antcall target="packjar" inheritall="true"> <mkdir dir="${target.dir}"/>
<param name="extension" value="par"/> <uptodate property="metamodel.build.notRequired" targetfile="${target.dir}/.staleflag">
<param name="jarname" value="defaultpar"/> <srcfiles dir="${src.dir}" includes="**/*.java"/>
</antcall> </uptodate>
</target>
<target name="packjar">
<property name="extension" value="jar"/>
<property name="packagename" value="${jarname}"/>
<property name="headerdirectory" value="."/>
<mkdir dir="${package.dir}"/>
<mkdir dir="${package.tmp.dir}/${headerdirectory}"/>
<copy todir="${package.tmp.dir}/${headerdirectory}">
<fileset dir="${classes.dir}">
<include name="**/test/pack/${packagename}/**.*"/>
</fileset>
</copy>
<jar destfile="${package.dir}/${jarname}.${extension}">
<fileset dir="${package.tmp.dir}">
<include name="**/*.*"/>
</fileset>
<fileset dir="${testresources.dir}/${jarname}">
<include name="**/*.*"/>
</fileset>
</jar>
<delete dir="${package.tmp.dir}"/>
</target>
<target name="packexploded">
<property name="extension" value="jar"/>
<mkdir dir="${package.dir}/${jarname}.${extension}"/>
<copy todir="${package.dir}/${jarname}.${extension}">
<fileset dir="${classes.dir}">
<include name="**/test/pack/${jarname}/**.*"/>
</fileset>
<fileset dir="${testresources.dir}/${jarname}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="package" description="Prepare all needed jars and pars">
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="par"/> <param name="extension" value="par"/>
<param name="jarname" value="defaultpar_1_0"/> <param name="jarname" value="defaultpar"/>
</antcall> </antcall>
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="par"/> <param name="extension" value="par"/>
<param name="jarname" value="space par"/> <param name="jarname" value="defaultpar_1_0"/>
<param name="packagename" value="spacepar"/> </antcall>
</antcall> <antcall target="packjar" inheritall="true">
<antcall target="packjar" inheritall="true"> <param name="extension" value="par"/>
<param name="extension" value="par"/> <param name="jarname" value="space par"/>
<param name="jarname" value="explicitpar"/> <param name="packagename" value="spacepar"/>
</antcall> </antcall>
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="par"/> <param name="extension" value="par"/>
<param name="jarname" value="excludehbmpar"/> <param name="jarname" value="explicitpar"/>
</antcall> </antcall>
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="jar"/> <param name="extension" value="par"/>
<param name="jarname" value="externaljar"/> <param name="jarname" value="excludehbmpar"/>
</antcall> </antcall>
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="par"/> <param name="extension" value="jar"/>
<param name="jarname" value="cfgxmlpar"/> <param name="jarname" value="externaljar"/>
</antcall> </antcall>
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="jar"/> <param name="extension" value="par"/>
<param name="jarname" value="overridenpar"/> <param name="jarname" value="cfgxmlpar"/>
</antcall> </antcall>
<antcall target="packjar" inheritall="true">
<param name="extension" value="jar"/>
<param name="jarname" value="overridenpar"/>
</antcall>
<!-- nested jar --> <!-- nested jar -->
<jar destfile="${package.dir}/nestedjar.ear"> <jar destfile="${package.dir}/nestedjar.ear">
<fileset dir="${package.dir}"> <fileset dir="${package.dir}">
<include name="defaultpar.par"/> <include name="defaultpar.par"/>
</fileset> </fileset>
</jar> </jar>
<copy todir="${package.dir}/nesteddir.ear"> <copy todir="${package.dir}/nesteddir.ear">
<fileset dir="${package.dir}"> <fileset dir="${package.dir}">
<include name="defaultpar.par"/> <include name="defaultpar.par"/>
</fileset> </fileset>
</copy> </copy>
<antcall target="packjar" inheritall="true"> <antcall target="packjar" inheritall="true">
<param name="extension" value="war"/> <param name="extension" value="war"/>
<param name="jarname" value="war"/> <param name="jarname" value="war"/>
<param name="headerdirectory" value="WEB-INF/classes"/> <param name="headerdirectory" value="WEB-INF/classes"/>
</antcall> </antcall>
<antcall target="packexploded" inheritall="true"> <antcall target="packexploded" inheritall="true">
<param name="extension" value="par"/> <param name="extension" value="par"/>
<param name="jarname" value="explodedpar"/> <param name="jarname" value="explodedpar"/>
</antcall> </antcall>
</target> </target>
</project> </project>

View File

@ -1,4 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -94,35 +96,50 @@
<testResource> <testResource>
<filtering>true</filtering> <filtering>true</filtering>
<directory>src/test/bundles</directory> <directory>src/test/bundles</directory>
<targetPath>../bundles</targetPath> <targetPath>../bundles</targetPath>
</testResource> </testResource>
</testResources> </testResources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<!-- Define one configuration outside executions and without a phase in order to allow 'mvn antrun:run' -->
<configuration>
<tasks>
<property name="target.dir" value="${project.build.directory}/generated-src/jpamodelgen"/>
<property name="src.dir" value="${project.build.testSourceDirectory}"/>
<property name="jdk16_home" value="${jdk16_home}"/>
<property name="classpath" refid="maven.test.classpath"/>
<ant antfile="${basedir}/build.xml">
<target name="generate-metamodel"/>
</ant>
</tasks>
</configuration>
<executions> <executions>
<execution> <execution>
<id>process_annotations</id> <id>process_annotations</id>
<phase>process-test-resources</phase> <phase>process-test-sources</phase>
<configuration>
<!-- No additional configuration needed. Unbound configuration gets inherited. (Feels wrong, but that's how it is) -->
<testSourceRoot>${project.build.directory}/generated-src/jpamodelgen</testSourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>package-tests</id>
<phase>process-test-classes</phase>
<configuration> <configuration>
<tasks> <tasks>
<echo>processing JPA annotations</echo> <property name="package.dir" value="${basedir}/target/test-packages"/>
<property name="target.dir" value="${project.build.directory}/generated-src/jpamodelgen"/> <property name="package.tmp.dir" value="${basedir}/target/tmp"/>
<mkdir dir="${target.dir}"/> <property name="classes.dir" value="${project.build.directory}/test-classes"/>
<javac srcdir="${project.build.testSourceDirectory}" <property name="testresources.dir" value="${basedir}/target/bundles"/>
destdir="${target.dir}" <ant antfile="${basedir}/build.xml">
failonerror="false" <target name="package"/>
fork="true" </ant>
executable="${jdk16_home}/bin/javac"
target="1.5">
<compilerarg value="-proc:only"/>
<classpath>
<path refid="maven.test.classpath"/>
</classpath>
</javac>
</tasks> </tasks>
<testSourceRoot>${project.build.directory}/generated-src/jpamodelgen</testSourceRoot>
</configuration> </configuration>
<goals> <goals>
<goal>run</goal> <goal>run</goal>
@ -130,29 +147,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>package-tests</id>
<phase>process-test-classes</phase>
<configuration>
<tasks>
<property name="package.dir" value="${basedir}/target/test-packages" />
<property name="package.tmp.dir" value="${basedir}/target/tmp" />
<property name="classes.dir" value="${project.build.directory}/test-classes" />
<property name="testresources.dir" value="${basedir}/target/bundles" />
<ant antfile="${basedir}/build.xml">
<target name="package" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
@ -173,32 +167,43 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<forkMode>pertest</forkMode> <forkMode>pertest</forkMode>
<additionalClasspathElements> <additionalClasspathElements>
<additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par</additionalClasspathElement> <additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par
<additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par</additionalClasspathElement> </additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/defaultpar_1_0.par</additionalClasspathElement> <additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par
<additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par</additionalClasspathElement> </additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par</additionalClasspathElement> <additionalClasspathElement>${basedir}/target/test-packages/defaultpar_1_0.par
<additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par</additionalClasspathElement> </additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar</additionalClasspathElement> <additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par
<additionalClasspathElement>${basedir}/target/test-packages/nesteddir.ear</additionalClasspathElement> </additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/nestedjar.ear</additionalClasspathElement> <additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par
<additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar</additionalClasspathElement> </additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement> <additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par
<additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement> </additionalClasspathElement>
</additionalClasspathElements> <additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar
</configuration> </additionalClasspathElement>
</plugin> <additionalClasspathElement>${basedir}/target/test-packages/nesteddir.ear
</additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/nestedjar.ear
</additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar
</additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/space par.par
</additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>doc</id> <id>doc</id>
<build> <build>
<plugins> <plugins>
@ -261,6 +266,6 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
</profiles> </profiles>
</project> </project>