我正在尝试使用maven插件将maven java项目的源文件夹添加到Eclipse.
尝试使用org.codehaus.mojo插件时,我收到以下错误
未能执行目标org.codehaus.mojo:建立辅助性Maven的插件:1.7:添加源(默认CLI)项目应用程序框架:参数"来源"为目标org.codehaus.mojo:建立辅助-maven-plugin:1.7:add-source缺失或无效 - > [帮助1]
通过阅读http://mojo.codehaus.org/build-helper-maven-plugin/usage.html上的文档,这应该是正确的吗?文件夹target/sources/mygeneratedfiles on存在.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/sources/mygeneratedfiles</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我想配置hibernate-jpamodelgen
到 Maven 中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">
<modelVersion>4.0.0</modelVersion>
<groupId>plugin</groupId>
<artifactId>org.plugin</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>Plugin</name>
<url>http://maven.apache.org</url>
<parent>
........
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.3.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>datalis_plugin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>10</source>
<target>10</target>
<encoding>${project.build.sourceEncoding}</encoding>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
</path>
</annotationProcessorPaths>
<compilerArguments>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Run Code Online (Sandbox Code Playgroud)
完整 POM:https: //pastebin.com/VjucMAYL
但我收到错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project org.plugin: Compilation failure
[ERROR] Annotation processor 'org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor' …
Run Code Online (Sandbox Code Playgroud)