I have a project that I have declared to have the "pom" package, with the intent of only releasing the XML schema (xsd) within the project via the build-helper-maven-plugin's attach-artifact goal.
However, I would like to run some unit tests that will generate the Java object graph via JAXB and run some marshalling and unmarshalling tests, then show me the results with the surefire report plugin. My problem is that the "pom" package only typically does the package, install, and deploy phases. I can bind additional goals to phases, which then seem to become part of the phases stack, like the generate-test-sources phase, but how can I add the test-compile and test phases when trying to reach the site milestone? I would like to just say "mvn site" and have the tests compile and run. I've tried running "mvn compiler:testCompile" and adding the generated sources to the test sources with the helper plugin, but trying to reach that goal also seems to just skip the generate-test-sources phase. Here is the current state of my pom.xml: <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>person-schema</artifactId> <version>1.0.0-SNAPSHOT</version> <name>Example Person Schema</name> <packaging>pom</packaging> <properties> <branch.name>trunk</branch.name> <branch.dir>${branch.name}</branch.dir> <jdk.version>1.5</jdk.version> <testSourceDir>src/test/unit/java</testSourceDir> <testOutputDir>target/test/unit/classes</testOutputDir> <testResourceDir>src/test/unit/resources</testResourceDir> </properties> <build> <testSourceDirectory>${testSourceDir}</testSourceDirectory> <testOutputDirectory>${testOutputDir}</testOutputDirectory> <testResources> <testResource> <directory>${testResourceDir}</directory> </testResource> </testResources> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>add-test-source</id> <phase>generate-test-sources</phase> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>target/generated-sources/jaxb</source> </sources> </configuration> </execution> <execution> <id>attach-artifacts</id> <phase>package</phase> <goals> <goal>attach-artifact</goal> </goals> <configuration> <artifacts> <artifact> <file>src/main/resources/Person.xsd</file> <type>xsd</type> </artifact> </artifacts> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <phase>generate-test-sources</phase> <goals> <goal>xjc</goal> </goals> <configuration> <packageName>com.example.vo</packageName> <schemaDirectory>src/main/resources</schemaDirectory> <schemaFiles>Person.xsd</schemaFiles> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.5</version> <configuration> <systemPropertyVariables> <property> <name>log4j.configuration</name> <value>test-log4j.xml</value> </property> </systemPropertyVariables> </configuration> </plugin> </plugins> </build> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.5</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.1.2</version> <reportSets> <reportSet> <reports> </reports> </reportSet> </reportSets> </plugin> </plugins> </reporting> <dependencies> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.2</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.6</version> <scope>test</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.5.6</version> <scope>test</scope> </dependency> </dependencies> </project> -Steve Maring Tampa, FL
