我正在使用Maven和Eclipse Photon构建GWT + App Engine + JDO项目(当我从命令行构建项目时出现相同错误)。编译阶段之后,Datanucleus通知我该错误:
Failed to execute goal org.datanucleus:maven-datanucleus-plugin:3.2.0-m1:enhance (default) on project gwtAppEngineJDOProjectName: Error while executing the DataNucleus tool 'org.datanucleus.enhancer.DataNucleusEnhancer'. Error while executing process. Cannot run program "/bin/sh": error=7
我的项目结构中的META-INF/jdoconfig.xml
有一个src/main/resources
。执行war插件后,META-INF/jdoconfig.xml
已正确存储在/ target / WARFOLDER / MET-INF /文件夹中。
我实际的jdo-conf:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">
<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>
<property name="javax.jdo.option.ConnectionURL" value="appengine"/>
<property name="datanucleus.cache.level2.mode" value="none"/>
<property name="javax.jdo.option.NontransactionalRead" value="true"/>
<property name="javax.jdo.option.NontransactionalWrite" value="true"/>
<property name="javax.jdo.option.RetainValues" value="true"/>
<property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
<property name="datanucleus.appengine.singletonPMFForName" value="true"/>
</persistence-manager-factory>
</jdoconfig>
pom.xml
上的自动增强过程
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.2.0-m1</version>
<configuration>
<api>JDO</api>
<props>${basedir}/datanucleus.properties</props>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.1.3</version>
</dependency>
</dependencies>
</plugin>
我该如何解决error = 7 Datanucleus错误? 谢谢。
答案 0 :(得分:0)
使用具有以下配置的datanucleus-maven-plugin:
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>5.0.2</version>
<configuration>
<fork>false</fork>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
增强过程在编译阶段后自动运行。 fork
参数已设置为false,以防止出现“参数列表过长”消息。参见http://www.datanucleus.org/products/accessplatform/jdo/enhancer.html#maven。