4

当用于处理 Java 8 的 Open JPA 元模型时,我从 maven-processor-plugin 收到下面列出的警告。我的项目实际上是构建的,但是对于 Java 8 是否有一个不生成此警告的版本?我没有看到 org.apache.openjpa.persistence.meta.AnnotationProcessor6 的 Java 8 版本。

警告:注释处理器'org.apache.openjpa.persistence.meta.AnnotationProcessor6'支持的源版本'RELEASE_6'低于-source'1.8'

        <plugin>
            <groupId>org.bsc.maven</groupId>
            <artifactId>maven-processor-plugin</artifactId>
            <version>3.2.0</version>
            <executions>
                <execution>
                    <id>process</id>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <phase>generate-sources</phase>
                    <configuration>
                        <processors>
                            <processor>org.apache.openjpa.persistence.meta.AnnotationProcessor6</processor>
                        </processors>
                        <optionMap>
                            <openjpa.metamodel>true</openjpa.metamodel>
                            <openjpa.source>8</openjpa.source>
                        </optionMap>
                        <outputDirectory>target/generated-sources/metamodel</outputDirectory>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <!-- OpenJPA -->
                <dependency>
                    <groupId>org.apache.openjpa</groupId>
                    <artifactId>openjpa</artifactId>
                    <version>${org.apache.openjpa.version}</version>
                </dependency>

                <dependency>
                    <groupId>org.apache.openjpa</groupId>
                    <artifactId>openjpa-all</artifactId>
                    <version>${org.apache.openjpa.version}</version>
                </dependency>
            </dependencies>
        </plugin>
4

1 回答 1

1

它最终使用这个例子对我有用:

<plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <version>2.1.0</version>
    <executions>
        <execution>
            <id>process</id>
            <goals>
                <goal>process</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
                <compilerArguments>-Aopenjpa.source=8 -Aopenjpa.metamodel=true</compilerArguments>
                <processors>
                    <processor>org.apache.openjpa.persistence.meta.AnnotationProcessor6</processor>
                </processors>
                <outputDirectory>target/generated-sources/metamodel</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

来自https://rmannibucau.wordpress.com/2013/01/24/enhancing-openjpa-classes-with-maven-maven-compiler-alternative/

于 2017-07-24T19:21:16.907 回答