Mavenでs2JdbcGen
久しぶりにSeaser2触ってます。
JdbcManager使ってますが、やっぱりEntity自動生成したいですね。
で、パスの問題とかあるので、mavenで実行させます。
pom.xml
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>default-cli</id> <configuration> <tasks> <property name="compile_classpath" refid="maven.compile.classpath" /> <ant antfile="src/main/resources/s2jdbc-gen-build.xml" target="${ant.target}" inheritRefs="true"> </ant> </tasks> </configuration> </execution> </executions> </plugin>
<?xml version="1.0" encoding="UTF-8"?> <project name="narwhal"> <target name="init"> <property name="classpathdir" value="target/classes"/> <property name="rootpackagename" value="jp.co.nosa1"/> <property name="entitypackagename" value="entity"/> <property name="javafiledestdir" value="src/main/java"/> <property name="javafileencoding" value="UTF-8"/> <property name="env" value="ut"/> <property name="jdbcmanagername" value="jdbcManager"/> <taskdef resource="s2jdbc-gen-task.properties" classpath="${compile_classpath}"/> </target> <target name="gen-entity" depends="init"> <gen-entity rootpackagename="${rootpackagename}" entitypackagename="${entitypackagename}" javafiledestdir="${javafiledestdir}" javafileencoding="${javafileencoding}" env="${env}" jdbcmanagername="${jdbcmanagername}" classpath="${compile_classpath}" /> </target> </project>
maven-antrun-pluginで実行
mvn antrun:run -Dant.target=gen-entity
参考:
MavenでS2JDBC-Genを使う - azuki note
maven で s2jdbc-gen - garbagetown