[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project mrlda: Compilation failure: Compilation failure:
[ERROR] /home/panwar/Downloads/Mr.LDA-master/src/main/java/cc/mrlda/polylda/TermReducer.java:[24,11] error: generics are not supported in -source 1.3
[ERROR]
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/panwar/Downloads/Mr.LDA-master/src/main/java/cc/mrlda/TermReducer.java:[33,11] error: generics are not supported in -source 1.3
Run Code Online (Sandbox Code Playgroud)
我正在使用最新版本的java.
解决了:问题出在maven身上.我使用的是旧版本(maven3.0.2)其他东西都是正确的.
Maven编译器插件和Maven surefire插件之间的基本区别是什么?
另外,我想在插件配置下的pom.xml内定义系统变量,并从我的Java代码(使用System.property())中读取它。
<configuration>
<systemPropertyVariables>
<envName>testEnv</envName>
</systemPropertyVariables>
</configuration>
Run Code Online (Sandbox Code Playgroud)
该配置与maven surefire插件一起使用,并且能够在我的java文件中读取它,但是,与maven编译器插件不一样。
使用delombok maven插件将我的所有文件放在'target/generated-sources/delombok'中.当我尝试运行maven编译器时,它会抱怨重复的类,所以我将addOutputDirectory设置为false,因为这个问题建议.现在的问题是delombok'ed文件被忽略,因此编译器抱怨缺少方法.
如何告诉maven编译器插件忽略默认的'src/main/java'目录,而是使用'target/generated-sources/delombok'目录进行编译?
运行mvn compile -X会在编译器运行时生成以下输出:
[DEBUG] (f) compileSourceRoots = [C:\Users\Jamey.Holden\workspace\Apollo\Website\src\main\java, C:\Users\Jamey.Holden\workspace\Apollo\Website\target\generated-sources\java]
[DEBUG] (f) compilerId = javac
[DEBUG] (f) debug = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) failOnError = true
[DEBUG] (f) forceJavacCompilerUse = false
[DEBUG] (f) fork = false
[DEBUG] (f) generatedSourcesDirectory = C:\Users\Jamey.Holden\workspace\Apollo\Website\target\generated-sources\annotations
[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.0:compile {execution: default-compile}
[DEBUG] (f) optimize = false
[DEBUG] (f) outputDirectory = C:\Users\Jamey.Holden\workspace\Apollo\Website\target\classes
[DEBUG] (f) proc = none
[DEBUG] (f) projectArtifact = ic.apollo:website:war:0.1
[DEBUG] (f) …Run Code Online (Sandbox Code Playgroud) 我试图从我的maven构建中排除一个测试(我不希望编译或执行测试).以下不起作用:
<project ...>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/MyTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
实现目标的正确方法是什么?我知道我可以使用命令行选项-Dmaven.test.skip=true,但我希望这可以成为其中的一部分pom.xml.
我需要在运行 Maven 构建时排除某些 Java 源文件作为最终构建的一部分进行编译。
我在基于 Spring Boot 的项目中使用 Spring Boot Maven 插件。
我正在寻找一种从编译中排除 Java 源文件的方法,并且在构建时也需要从最终构建中排除相应的 Junit 测试类。
有没有办法使用 Spring Boot Maven 插件实现相同的目标?
toggle maven-compiler-plugin spring-boot spring-boot-maven-plugin
我正在使用 Maven 编译器插件 3.0,但出现错误“此处不允许使用 Element compilerArgs”。这似乎适用于命令行,但我在 IDE 中收到此错误。我使用 IDEA 2017.2 社区版。某处可能缺少一些架构,但我不确定。有没有人有解决此类问题的好方法,即不向 JetBrains 发送错误报告并等待修复?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<fork>true</fork>
<compilerArgs>
<arg>-DspecificArg</arg>
</compilerArgs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我有一个Java代码,我想为Java 1.7构建.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<terget>1.7</terget>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
javacTask: source release 1.7 requires target release 1.7
Run Code Online (Sandbox Code Playgroud)
以下调试输出显示目标是1.5:
-d C:\Users\przemekb\Documents\NetBeansProjects\ManagingPersistanceObjects\target\classes -classpath
C:\Users\przemekb\Documents\NetBeansProjects\ManagingPersistanceObjects\target\classes;
C:\Users\przemekb\.m2\repository\org\hibernate\hibernate-validator\5.0.0.Final\hibernate-validator-5.0.0.Final.jar;
C:\Users\przemekb\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;
C:\Users\przemekb\.m2\repository\org\jboss\logging\jboss-logging\3.1.1.GA\jboss-logging-3.1.1.GA.jar;
C:\Users\przemekb\.m2\repository\com\fasterxml\classmate\0.8.0\classmate-0.8.0.jar;
C:\Users\przemekb\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;
C:\Users\przemekb\.m2\repository\javax\persistence\persistence-api\1.0\persistence-api-1.0.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\javax.persistence\2.1.0\javax.persistence-2.1.0.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\eclipselink\2.5.1\eclipselink-2.5.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\commonj.sdo\2.1.1\commonj.sdo-2.1.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.jpa\2.5.1\org.eclipse.persistence.jpa-2.5.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.asm\2.5.1\org.eclipse.persistence.asm-2.5.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.antlr\2.5.1\org.eclipse.persistence.antlr-2.5.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.jpa.jpql\2.5.1\org.eclipse.persistence.jpa.jpql-2.5.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.core\2.5.1\org.eclipse.persistence.core-2.5.1.jar;
C:\Users\przemekb\.m2\repository\org\apache\derby\derby\10.10.1.1\derby-10.10.1.1.jar;
C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.jpa.modelgen.processor\2.5.1\org.eclipse.persistence.jpa.modelgen.processor-2.5.1.jar; -sourcepath
C:\Users\przemekb\Documents\NetBeansProjects\ManagingPersistanceObjects\src\main\java; -s
C:\Users\przemekb\Documents\NetBeansProjects\ManagingPersistanceObjects\target\generated-sources\annotations -g -nowarn -target 1.5 -source 1.7 -encoding UTF-8
Run Code Online (Sandbox Code Playgroud)
如何在NetBeans IDE中解决此问题?
看到maven中的编译错误.检查并尝试了我从谷歌和堆栈*网站获得的所有变通办法.但我还是无法解决.
已安装的maven 3.3.3及其支持的java版本1.7.请注意我没有设置JAVA_HOME,M2和M2_HOME环境变量.但仍然走这条路.
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /usr/local/apache-maven-3.3.3
Java version: 1.7.0_85, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-573.3.1.el6.x86_64", arch: "amd64", family: "unix"
Run Code Online (Sandbox Code Playgroud)
错误是
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/sdiuser/Build-Release/hg-artifactid/src/main/java/hg-groupid/App.java:[1,11] ';' expected
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.007 s
[INFO] Finished at: 2015-08-31T02:43:32-04:00
[INFO] Final Memory: 9M/158M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal …Run Code Online (Sandbox Code Playgroud) 我正在将我的 Maven JavaFX 应用程序从 Java 8 迁移到 Java 11。我将 pom.xml 中的插件更新为最新的(兼容 Java 11 的)插件。编译运行良好,在“目标”文件夹下的正确目录中为我提供了 jar 以及所有依赖项和模块,但是当我尝试运行 jar 文件时,我收到了可怕的“缺少 JavaFX 应用程序类”错误。无论我如何尝试更改插件配置 - 我总是收到此错误消息,并且应用程序将无法运行。
现在,更多发现: 1. 主类确实位于类下的正确文件夹和 jar 中。2. Manifest 文件位于正确的位置,并且包含主类属性(在 Java 8 下工作正常)。
这是相关部分
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<release>11</release>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerVersion>11</compilerVersion>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>false</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
<manifestEntries>
<JavaFX-Application-Class>${mainClass}</JavaFX-Application-Class>
</manifestEntries>
</archive>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-libs</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
<includeScope>runtime</includeScope>
<excludeGroupIds>org.openjfx</excludeGroupIds> …Run Code Online (Sandbox Code Playgroud) 使用 JDK 1.8 编译时出现 maven 编译器错误
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project DUMMY : Fatal error compiling: invalid flag: --release -> [Help 1]
这是我的编译器插件的 pom 配置
<configuration>
<source>${maven.compiler.release}</source>
<target>${maven.compiler.release}</target>
<release>${maven.compiler.release}</release>
<jdkToolchain>
<version>${maven.compiler.release}</version>
</jdkToolchain>
<verbose>false</verbose>
<useIncrementalCompilation>false</useIncrementalCompilation>
<executable>${env.JAVA_HOME}/bin/javac</executable>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我是否错误地配置了这个?此外,当我使用 Java 11 for 时,这工作正常JAVA_HOME,但不适用于 Java 8。这是预期的吗?此外,从文档中我看到无论如何maven.compiler.release都与release配置相关。那么,这是否意味着我可以省略release下面的属性并且应该没问题?
I have a spring boot application with mapstruct where I get this warning on the maven-compiler-plugin testCompile phase:
[WARNING] The following options were not recognized by any processor: '[mapstruct.suppressGeneratorTimestamp]'
As I don't want warnings in my code I have been searching to solve this issue but the only thing that worked this far is to use <showWarnings>false</showWarnings>
我应该怎么做才能解决此警告而不将其静音?
申请文件:
pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
</parent>
<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> …Run Code Online (Sandbox Code Playgroud)