Maven,Tapestry和Google Appengine魔术组合

时间:2012-07-10 19:04:04

标签: google-app-engine maven tapestry

我无法启动一个工作正常的旧应用程序,但现在我需要进行一些更改,它会抱怨旧sdk(1.5.x),所以我要转向1.7.0。但是,当我勉强得到错误时,在本地它运行得很好,所以我不知道是什么问题。

有问题的错误是来自datanucleus的缺失类。

类org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory

以下是依赖项。任何想法

<dependencies>

    <!-- Google App Engine meta-package -->
    <dependency>
        <groupId>net.kindleit</groupId>
        <artifactId>gae-runtime</artifactId>
        <version>${gae.version}</version>
        <type>pom</type>
    </dependency>   

    <dependency>
        <groupId>com.googlecode.gwtupload</groupId>
        <artifactId>gwtupload</artifactId>
        <version>0.6.5-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>com.googlecode.gwtupload</groupId>
        <artifactId>gwtupload-gae</artifactId>
        <version>0.6.5-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tapestry</groupId>
        <artifactId>tapestry-upload</artifactId>
        <version>${tapestry-release-version}</version>
    </dependency><!--
   <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2.1</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.0.1</version>
    </dependency>-->

    <!--    <dependency>
        <groupId>org.got5</groupId>
        <artifactId>tapestry5-jquery</artifactId>
        <version>2.1.0</version>
    </dependency> -->

    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>${datanucleus.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>

    <!-- These dependencies are here just for enabling logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.1</version>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>0.9.24</version>
    </dependency>

    <!-- Test scope -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.5</version>
        <scope>test</scope>
    </dependency>

    <!--
                            GAE libraries for local testing as described here:
                            http://code.google.com/appengine/docs/java/howto/unittesting.html
        -->
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-labs</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-stubs</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-testing</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>javax.jdo</groupId>
        <artifactId>jdo2-api</artifactId>
        <version>2.3-eb</version>
        <exclusions>
            <exclusion>
                <groupId>javax.transaction</groupId>
                <artifactId>transaction-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.apache.tapestry</groupId>
        <artifactId>tapestry-core</artifactId>
        <version>${tapestry-release-version}</version>
    </dependency>

    <!-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests)
    will fail, preventing Maven from packaging the WAR. Tapestry includes a large number
    of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. -->

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>5.12.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>2.5.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.tapestry</groupId>
        <artifactId>tapestry-test</artifactId>
        <version>${tapestry-release-version}</version>
        <scope>test</scope>
    </dependency>

    <!-- Provided by the servlet container, but sometimes referenced in the application
    code. -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>

</dependencies>
<build> 
    <plugins>

        <!--This plug-in "enhances" your domain model objects 
        (i.e. makes them persistent for datanucleus) -->
        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>maven-datanucleus-plugin</artifactId>
            <version>1.1.4</version>
            <configuration>
                <!--Make sure this path contains your persistent classes! -->
                <mappingIncludes>**/domain/*.class</mappingIncludes>
                <verbose>true</verbose>
                <enhancerName>ASM</enhancerName>
                <api>JDO</api>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-core</artifactId>
                    <version>${datanucleus.version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>javax.transaction</groupId>
                            <artifactId>transaction-api</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-rdbms</artifactId>
                    <version>${datanucleus.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-enhancer</artifactId>
                    <version>1.1.4</version>
                </dependency>
                <dependency>
                    <groupId>javax.jdo</groupId>
                    <artifactId>jdo2-api</artifactId>
                    <version>2.3-ec</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3-SNAPSHOT</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>src/main/webapp</directory>
                        <filtering>true</filtering>
                        <includes>
                            <include>**/appengine-web.xml</include>
                        </includes>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

        <!-- The actual maven-gae-plugin. 
        Type "mvn gae:run" to run project, "mvn gae:deploy" to upload to GAE. -->
        <plugin>
            <groupId>net.kindleit</groupId>
            <artifactId>maven-gae-plugin</artifactId>
            <version>0.8.4</version>
            <dependencies>
                <dependency>
                    <groupId>net.kindleit</groupId>
                    <artifactId>gae-runtime</artifactId>
                    <version>${gae.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </plugin>

        <!-- Upload application to the appspot automatically, during release:perform -->
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <goals>gae:deploy</goals>
            </configuration>
        </plugin>

        <!-- Java compiler version -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<reporting>

    <!-- Adds a report detailing the components, mixins and base classes defined by this module. -->
    <plugins>
        <plugin>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-component-report</artifactId>
            <version>${tapestry-release-version}</version>
            <configuration>
                <rootPackage>root</rootPackage>
            </configuration>
        </plugin>
    </plugins>
</reporting>

<repositories>

    <!-- This repository is only needed when the tapestry-release-version is a snapshot release. -->
    <repository>
        <id>apache-snapshots</id>
        <url>http://repository.apache.org/snapshots/</url>
    </repository>

    <repository>
        <id>sonatype-snapshots</id>
        <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>

    <repository>
        <id>devlab722-repo</id>
        <url>http://nexus.devlab722.net/nexus/content/repositories/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>

    <repository>
        <id>devlab722-snapshot-repo</id>
        <url>http://nexus.devlab722.net/nexus/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>

</repositories>

<pluginRepositories>

    <!-- As above, this can be commented out when access to the snapshot version
    of a Tapestry Maven plugin is not required.   -->
    <pluginRepository>
        <id>apache-snapshots</id>
        <url>http://repository.apache.org/snapshots/</url>
    </pluginRepository>

</pluginRepositories>

<properties>  

    <!-- Sets the project's default encoding.
    http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- This is just for "eclipse:eclipse" goal to always attempt downloading sources             
    -->
    <downloadSources>true</downloadSources>

    <!-- Specify AppEngine version for your project. It should match SDK version ointed
    to by ${gae.home} property (Typically, one used by our Eclipse plug-in) -->
    <gae.version>1.7.0</gae.version>

    <!-- Upload to http://test.latest.<applicationName>.appspot.com by default -->
    <gae.application.version>test</gae.application.version>

    <datanucleus.version>1.1.5</datanucleus.version>
    <tapestry-release-version>5.2.5</tapestry-release-version>

</properties>
<profiles>
    <!-- We can configure our integration server to activate this profile and
     perform gae:deploy, thus uploading latest snapshot to the
     http://1.latest.<applicationName>.appspot.com automatically -->
    <profile>
        <id>integration-build</id>
        <properties>
            <gae.application.version>stage</gae.application.version>
        </properties>
    </profile>

    <profile>
        <id>release-build</id>
        <activation>
            <property>
                <name>performRelease</name>
                <value>true</value>
            </property>
        </activation>

        <properties>
            <!-- During release, set application version in appengine-web.xml to 2-->
            <gae.application.version>release</gae.application.version>
        </properties>

    </profile>
</profiles>

1 个答案:

答案 0 :(得分:1)

这就是我的诀窍

<dependencies>

    <!-- Google App Engine meta-package -->
    <dependency>
        <groupId>net.kindleit</groupId>
        <artifactId>gae-runtime</artifactId>
        <version>${gae.version}</version>
        <type>pom</type>
    </dependency>   

    <dependency>
        <groupId>com.googlecode.gwtupload</groupId>
        <artifactId>gwtupload</artifactId>
        <version>0.6.4</version>
    </dependency>

    <dependency>
        <groupId>com.googlecode.gwtupload</groupId>
        <artifactId>gwtupload-gae</artifactId>
        <version>0.6.4</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tapestry</groupId>
        <artifactId>tapestry-upload</artifactId>
        <version>${tapestry-release-version}</version>
    </dependency><!--
   <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2.1</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.0.1</version>
    </dependency>-->

    <!--    <dependency>
        <groupId>org.got5</groupId>
        <artifactId>tapestry5-jquery</artifactId>
        <version>2.1.0</version>
    </dependency> -->

    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>${datanucleus.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>

    <!-- These dependencies are here just for enabling logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.1</version>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>0.9.24</version>
    </dependency>

    <!-- Test scope -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.5</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-labs</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-stubs</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-testing</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>javax.jdo</groupId>
        <artifactId>jdo2-api</artifactId>
        <version>2.3-eb</version>
        <exclusions>
            <exclusion>
                <groupId>javax.transaction</groupId>
                <artifactId>transaction-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.apache.tapestry</groupId>
        <artifactId>tapestry-core</artifactId>
        <version>${tapestry-release-version}</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>5.12.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>2.5.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.tapestry</groupId>
        <artifactId>tapestry-test</artifactId>
        <version>${tapestry-release-version}</version>
        <scope>test</scope>
    </dependency>

    <!-- Provided by the servlet container, but sometimes referenced in the application
    code. -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>

</dependencies>
<build> 
    <plugins>

        <!--This plug-in "enhances" your domain model objects 
        (i.e. makes them persistent for datanucleus) -->
        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>maven-datanucleus-plugin</artifactId>
            <version>1.1.4</version>
            <configuration>
                <!--Make sure this path contains your persistent classes! -->
                <mappingIncludes>**/domain/*.class</mappingIncludes>
                <verbose>true</verbose>
                <enhancerName>ASM</enhancerName>
                <api>JDO</api>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-core</artifactId>
                    <version>${datanucleus.version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>javax.transaction</groupId>
                            <artifactId>transaction-api</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-rdbms</artifactId>
                    <version>${datanucleus.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-enhancer</artifactId>
                    <version>1.1.4</version>
                </dependency>
                <dependency>
                    <groupId>javax.jdo</groupId>
                    <artifactId>jdo2-api</artifactId>
                    <version>2.3-ec</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>src/main/webapp</directory>
                        <filtering>true</filtering>
                        <includes>
                            <include>**/appengine-web.xml</include>
                        </includes>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

        <!-- The actual maven-gae-plugin. 
        Type "mvn gae:run" to run project, "mvn gae:deploy" to upload to GAE. -->
        <plugin>
            <groupId>net.kindleit</groupId>
            <artifactId>maven-gae-plugin</artifactId>
            <version>0.9.3</version>
            <configuration> 
                <splitJars>true</splitJars>
                <unpackVersion>${gae.version}</unpackVersion>
                <jvmFlags> 
                    <jvmFlag>-Dappengine.user.timezone=UTC</jvmFlag> 
                </jvmFlags>                    
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>net.kindleit</groupId>
                    <artifactId>gae-runtime</artifactId>
                    <version>${gae.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </plugin>

        <!-- Upload application to the appspot automatically, during release:perform -->
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <goals>gae:deploy</goals>
            </configuration>
        </plugin>

        <!-- Java compiler version -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<reporting>

    <plugins>
        <plugin>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-component-report</artifactId>
            <version>${tapestry-release-version}</version>
            <configuration>
                <rootPackage>com.bomahabo.chesapool.tapestry</rootPackage>
            </configuration>
        </plugin>
    </plugins>
</reporting>

<repositories>

    <repository>
        <id>apache-snapshots</id>
        <url>http://repository.apache.org/snapshots/</url>
    </repository>

    <repository>
        <id>sonatype-snapshots</id>
        <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>

    <repository>
        <id>devlab722-repo</id>
        <url>http://nexus.devlab722.net/nexus/content/repositories/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>

    <repository>
        <id>devlab722-snapshot-repo</id>
        <url>http://nexus.devlab722.net/nexus/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>

</repositories>

<pluginRepositories>

    <!-- As above, this can be commented out when access to the snapshot version
    of a Tapestry Maven plugin is not required.   -->
    <pluginRepository>
        <id>apache-snapshots</id>
        <url>http://repository.apache.org/snapshots/</url>
    </pluginRepository>

</pluginRepositories>

<properties>  

    <!-- Sets the project's default encoding.
    http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>


    <downloadSources>true</downloadSources>

    <gae.version>1.5.1</gae.version> 
    <gae.application.version>test</gae.application.version>

    <datanucleus.version>1.1.5</datanucleus.version>
    <tapestry-release-version>5.2.5</tapestry-release-version>

</properties>
<profiles>
    <!-- We can configure our integration server to activate this profile and
     perform gae:deploy, thus uploading latest snapshot to the
     http://1.latest.<applicationName>.appspot.com automatically -->
    <profile>
        <id>integration-build</id>
        <properties>
            <gae.application.version>stage</gae.application.version>
        </properties>
    </profile> 

    <profile>
        <id>release-build</id>
        <activation>
            <property>
                <name>performRelease</name>
                <value>true</value>
            </property>
        </activation>

        <properties>
            <!-- During release, set application version in appengine-web.xml to 2-->
            <gae.application.version>release</gae.application.version>
        </properties>

    </profile>
</profiles>