java - Maven GAE/Datanucleus 不确定性

标签 java google-app-engine maven-2 google-cloud-datastore maven-gae-plugin

我今天花了一些时间,尝试生成我的第一个 Maven 管理的 Google 应用引擎 1.5.4 + GWT 2.4.0 版本。

我终于到了一切都可以编译并且 gae:run 目标有效的阶段。这比我想象的要多,但是嘿,这一切都很有趣。

无论如何,我现在的问题是,尽管一切正常,但当 datanucleus 增强器运行时我收到以下错误。

[ERROR] --------------------
[ERROR]  Standard error from the DataNucleus tool + org.datanucleus.enhancer.DataNucleusEnhancer :
[ERROR] --------------------
[ERROR] Oct 02, 2011 11:04:39 PM org.datanucleus.enhancer.DataNucleusEnhancer <init>
INFO: DataNucleus Enhancer : Using ClassEnhancer "ASM" for API "JDO"
Oct 02, 2011 11:04:39 PM org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints
INFO: Bundle "org.datanucleus" has an optional dependency to "org.eclipse.equinox.registry" but it cannot be resolved
Oct 02, 2011 11:04:39 PM org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints
INFO: Bundle "org.datanucleus" has an optional dependency to "org.eclipse.core.runtime" but it cannot be resolved
Oct 02, 2011 11:04:39 PM org.datanucleus.enhancer.DataNucleusEnhancer main
INFO: DataNucleus Enhancer (version 1.1.4) : Validation of enhancement state
Oct 02, 2011 11:04:40 PM org.datanucleus.jdo.metadata.JDOAnnotationReader processClassAnnotations
INFO: Class "net.kindleit.gae.example.model.Message" has been specified with JDO annotations so using those.
Oct 02, 2011 11:04:40 PM org.datanucleus.metadata.MetaDataManager loadClasses
INFO: Class "net.kindleit.gae.example.model.Messages" has no MetaData or annotations. 
Oct 02, 2011 11:04:40 PM org.datanucleus.enhancer.DataNucleusEnhancer addMessage
INFO: ENHANCED (PersistenceCapable) : net.kindleit.gae.example.model.Message
Oct 02, 2011 11:04:40 PM org.datanucleus.enhancer.DataNucleusEnhancer addMessage
INFO: DataNucleus Enhancer completed with success for 1 classes. Timings : input=78 ms, enhance=15 ms, total=93 ms. Consult the log for full details
[ERROR] --------------------

那里发生了什么事? [错误] block 是怎么回事?看起来根本没有任何错误?

此外,我收到以下警告,但我不完全理解

[WARNING] Could not transfer metadata asm:asm/maven-metadata.xml from/to local.repository (file:../../local.repository/trunk): No connector available to access repository local.repository (file:../../local.repository/trunk) of type legacy using the available factories WagonRepositoryConnectorFactory

最后,为什么所有依赖项都添加到 datanucleus enchancer 类路径中? 有一条来自 datanucleus 增强器的 [INFO] 消息,列出了其类路径中的所有 jar,它似乎包含了所有内容,这是怎么回事?我本以为那里只需要 JDO 和持久性相关的库?

最佳答案

我和你有同样的错误。然后我将版本更改为最新版本。错误消失了。

<properties>
    <datanucleus.version>3.0.1</datanucleus.version>
    <maven-datanucleus-plugin>3.0.0-release</maven-datanucleus-plugin>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

    <!--datanucleus related dependencies-->
    <dependency>
        <groupId>com.google.appengine.orm</groupId>
        <artifactId>datanucleus-appengine</artifactId>
        <version>1.0.10</version>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>${datanucleus.version}</version>
        <scope>runtime</scope>
        <exclusions>
            <exclusion>
                <groupId>javax.transaction</groupId>
                <artifactId>transaction-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!--jdo related dependencies-->
    <dependency>
        <groupId>javax.jdo</groupId>
        <artifactId>jdo2-api</artifactId>
        <version>2.3-ec</version>
        <exclusions>
            <!--
                exclude the legacy javax.transaction:transaction-api and replace it
                with javax.transaction:jta (it appears to be the same thing)
            -->
            <exclusion>
                <groupId>javax.transaction</groupId>
                <artifactId>transaction-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>


<build>
    <plugins>
    ..........
        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>maven-datanucleus-plugin</artifactId>
            <version>${maven-datanucleus-plugin}</version>
            <configuration>
                <!--
                    Make sure this path contains your persistent classes!
                -->
                <mappingIncludes>**/db/*.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>${datanucleus.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-api-jdo</artifactId>
                    <version>${datanucleus.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

关于java - Maven GAE/Datanucleus 不确定性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7629698/

相关文章:

java - 为什么JSON文档没有被完全消费?

java - 使用 GSON 将 JSON 转换为 Java 会引发错误

java - 使用 Java 的 App Engine 数据存储区中的特定条目正在破坏我的应用程序

java - Google App Engine 上的 JDO 与 JPA for Java

java - 如何摆脱 Java Web 服务器 url 中的目录前缀?

maven-2 - 使用 Struts 1 原型(prototype)创建 Maven 2 项目

java - 406 当在 Spring Controller 中抛出异常并接受文本/csv header 时

java - android 中允许使用 java 库吗?

java - 需要 AppEngine 数据存储区设计建议

eclipse - 多模块 m2eclipse/WTP 项目能否将实用程序模块部署到 WEB-INF/类中?