最低限のpomを記載しておく。ポイントは”datanucleus-appengine"と"datanucleus-core"のscopeをruntimeにしておく事。こいつらがビルド時に取り込まれてしまうとmaven-datanucleus-pluginでのエンハンス中にエラー停止してしまう。
先のエントリで書いた単体試験の内容で、$ mvn clean testしてテストが通る事を確認できるはずだ。
<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.shin1ogawa</groupId> <artifactId>gae-jdo-simple-sample</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>GAE JDO Simple Sample</name> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>javax.jdo</groupId> <artifactId>jdo2-api</artifactId> <version>2.3-SNAPSHOT</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.5</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-library</artifactId> <version>1.1</version> <scope>test</scope> </dependency> <!-- GAE for java(compile) --> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api</artifactId> <version>1.0-sdk-1.2.0</version> </dependency> <!-- GAE for java(test) --> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api-stubs</artifactId> <version>1.0</version> <scope>test</scope> </dependency> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-local-runtime</artifactId> <version>1.0</version> <scope>test</scope> </dependency> <!-- GAE for java(runtime) --> <dependency> <groupId>com.google.appengine</groupId> <artifactId>datanucleus-appengine</artifactId> <version>1.0.0.final</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-core</artifactId> <version>1.1.0</version> <scope>runtime</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <!-- http://www.datanucleus.org/products/accessplatform/enhancer.html#maven2 --> <groupId>org.datanucleus</groupId> <artifactId>maven-datanucleus-plugin</artifactId> <version>1.1.0</version> <configuration> <verbose>true</verbose> <mappingIncludes>**/entity/*.class</mappingIncludes> <fork>true</fork> <enhancerName>ASM</enhancerName> <api>JDO</api> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>enhance</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <excludes> <exclude>**/TestEnvironment.java</exclude> <exclude>**/Abstract*.java</exclude> </excludes> </configuration> </plugin> </plugins> </build> <repositories> <repository> <id>DataNucleus</id> <url>http://www.datanucleus.org/downloads/maven2</url> </repository> <repository> <id>mvnsearch</id> <url>http://www.mvnsearch.org/maven2</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>DataNucleus</id> <url>http://www.datanucleus.org/downloads/maven2</url> </pluginRepository> </pluginRepositories> </project>
これでHudsonのMavenプロジェクトでのCIも可能になりますね!
0 件のコメント:
コメントを投稿