DataNucleus插件:资源与文件系统不同步

时间:2014-02-28 23:06:45

标签: java eclipse maven tomcat datanucleus

我在Tomcat中启动应用程序时遇到Eclipse错误(通过运行方式>在服务器上运行。)我正在使用DataNucleus Eclipse Plugin并将其设置为启用自动增强功能。

Publishing failed with multiple errors
Resource is out of sync with the file system: '/myproject/target/classes/com/mysite/models/Inventory.class'.
Resource is out of sync with the file system: '/myproject/target/classes/com/mysite/models/Product.class'.

我知道每次我想在服务器上运行项目时,我都可以手动触发该项目的刷新。有办法克服这种不便吗?

注意:我也理解Eclipse可以配置为在访问时刷新,使用本机挂钩或使用轮询。然而,这会触发多个不必要的数据核运行:增强。此外,当Tomcat配置为在资源更改时或构建事件后自动发布时,问题更加复杂。

作为参考,我的pom.xml的相关摘录在

之下
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

    <packaging>war</packaging>

    <properties>
        <datanucleus.core.version>3.2.12</datanucleus.core.version>
        <datanucleus.api.version>3.0.1</datanucleus.api.version>
    </properties>

    <dependencies>
        <!-- Database See http://www.datanucleus.org/products/datanucleus/jdo/maven.html -->
        <dependency>
            <groupId>javax.jdo</groupId>
            <artifactId>jdo-api</artifactId>
            <version>${datanucleus.api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-core</artifactId>
            <version>${datanucleus.core.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-api-jdo</artifactId>
            <version>[3.2.0, 3.2.99)</version>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-rdbms</artifactId>
            <version>[3.2.0, 3.2.99)</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.3.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- JDO Enhancer See http://www.datanucleus.org/products/datanucleus/jdo/guides/eclipse.html -->
            <plugin>
                <groupId>org.datanucleus</groupId>
                <artifactId>datanucleus-maven-plugin</artifactId>
                <version>3.3.0-release</version>
                <configuration>
                    <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
                    <verbose>true</verbose>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.datanucleus</groupId>
                        <artifactId>datanucleus-core</artifactId>
                        <version>${datanucleus.core.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.jdo</groupId>
                        <artifactId>jdo-api</artifactId>
                        <version>${datanucleus.api.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-enforcer-plugin</artifactId>
                                        <versionRange>[1.0.0,)</versionRange>
                                        <goals>
                                            <goal>enforce</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.datanucleus
                                        </groupId>
                                        <artifactId>
                                            datanucleus-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [3.3.0-release,)
                                        </versionRange>
                                        <goals>
                                            <goal>enhance</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

0 个答案:

没有答案