问题标签 [maven-compiler-plugin]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
spring-data-neo4j - 带有 maven-compiler-plugin 和 xlint 的 spring-data-neo4j 导致编译器警告
我的任务是将 spring-data-neo4j Maven 依赖项集成到一个项目中,该项目使用带有 Xlint 和 -Werror 标志的 maven-compiler-plugin。我遇到了一些需要修复的编译问题。
构建一个依赖于 spring-data-neo4j 的 Maven 项目,并且此构建配置发出编译警告,导致构建失败。我不能随意更改这个项目的构建配置,所以我试图找到一种方法来消除编译器警告。
我通过将http://github.com/spring-guides/gs-accessing-data-neo4j项目分叉到https://github.com/spencerhrob/gs-accessing-data-neo4j重现了这个问题。
在with-xlint分支中,pom.xml 文件的“build”部分已更改为以下内容:
在此分支的完整文件夹中运行mvn clean package会返回以下编译错误:
通过删除 -Xlint 标志(如在without-xlint分支中)可以预见地导致不发出编译器警告。此外,删除 -Werror 标志(如在without-werror分支中)会导致发出警告,但 Maven 构建仍然成功完成。
我还尝试将 Xlint 与父 gs-accessing-data-neo4j 项目中使用的 spring-boot-maven-plugin 构建插件一起使用。我的存储库中的without-maven-compiler-plugin分支具有以下配置:
即使在编译器参数中指定了 Xlint,在此分支上运行mvn clean package也不会返回编译器警告(尽管我承认我不完全确定 Xlint 正在运行)。
我知道我可以通过删除 maven-compiler-plugin 或删除 -Xlint 或 -Werror 标志来解决这个问题,但这不是一个选项,因为我无法更改我正在工作的项目的构建配置on(这不是引用的 GitHub 存储库)。
有一个已知的原因为什么使用带有 -Xlint 和 -Werror 标志的 maven-compiler-plugin 构建依赖于 spring-data-neo4j 的项目会导致“没有处理器声明任何这些注释”编译器警告?而且,有没有办法在不删除 maven-compiler-plugin 或 -Xlint 和 -Werror 标志的情况下消除编译器警告?
java - 未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
我正在使用最新版本的java。
已解决:问题出在 Maven 上。我使用的是旧版本(maven3.0.2)其他事情是正确的。
maven - 未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:3。2:compile (default-compile) on project ***: 编译失败
我用maven构建java项目,从jdk1.7 32bit升级到jdk1.7 64bit后,构建无法成功。
版本是:
maven信息是:
但是当我用 Maven 构建时:
错误是:
有什么问题?我的JDK版本是一致的。
maven - Installing and compiling Maven artifacts on Java 8
I have a project with a pom.xml that has the following <build> declaration:
When I run mvn install on this project, it compiles the project, runs unit tests and publishes it to my local repo. I am trying to learn a little more about Maven here, and am having a tough time finding documentation/explanations on the following:
- How am I able to run
mvn install, if the POM doesn't declare it underbuild/plugins? Doesmaven-compiler-pluginincludemaven-install-plugin, if so, how could I have figured that out? - Most importantly: the value of
build/plugins/plugin/configuration/sourceand.../targetare both set to1.8. If my machine has Java 8 on it, and I runmvn installon this project without any errors, does that guarantee that the project builds with Java 8? I'm looking at the docs for the Compiler Plugin and don't see thosesource/targetconfigs listed anywhere.
eclipse - Maven 编译器插件错误
我在 pom.xml 中有以下代码用于指定 maven-compiler-plugin:
虽然项目编译并运行正常,但我的项目根目录上有一个错误标志(我使用的是 Eclipse)。
如果我注释掉这段摘录,错误就会消失,但当然,项目不会编译。我检查了Maven 网站,但规范是相同的。
你能帮我解决这个问题吗?
解决方案(感谢 AleksandrM)
除非显式调用 maven 更新项目,否则无法将 pom.xml 中的更改应用于 eclipse 项目设置。
单击项目根目录上的 ALT + F5 并更新 maven 项目
java - Maven-compiler-plugin 排除在 3.3 中失败
我在 maven-compiler-plugin 3.2 中使用了它,它运行良好,但是当我升级到 3.3 时,排除不再起作用。是什么改变打破了我的排除?
情况:

这是我的包裹清单。我想排除所有以 bammerbom.ultimatecore.spongeapi 开头的包,因为它们是 WIP。这适用于 maven-compiler-plugin 3.2,但在更新后失败并出现下面的堆栈跟踪。(所有错误都在那里,但这不是问题,因为我还不想编译这个包。)
插件的 Pom.xml:
堆栈跟踪:
maven - maven - 没有要编译的源代码,没有要运行的测试,无法读取执行数据文件
我希望声纳使用 jacoco 代码覆盖率报告来显示我的项目的代码质量。我可以使用 jacoco 生成代码覆盖率报告,还可以为我的单元测试生成一个可执行文件 jacoco-ut.exec。当我使用詹金斯时,我会收到以下消息。
我在项目中使用旧的目标文件夹,因此构建成功
maven-2 - Maven 排除目录在测试下编译和运行
我正在尝试为我的代码设置我的第一个 maven 项目,可以在这里找到: https ://github.com/jkinable/jorlib
我有 3 个 pom 文件:
- https://github.com/jkinable/jorlib/blob/master/pom.xml
- https://github.com/jkinable/jorlib/blob/master/jorlib-core/pom.xml
- https://github.com/jkinable/jorlib/blob/master/jorlib-demo/pom.xml
我想从编译和测试中排除以下目录中的所有文件:
注意“测试”部分。根据这个网站,我可以将 maven-compiler-plugin 与 excludes 和 testExcludes 一起使用。所以我添加了插件:
我已经尝试了大量的排除规则(以上只是一小部分)。我运行“mvn clean; mvn test”,但我仍然不断收到内部类的编译错误
关于如何处理这个问题的任何建议?
environment-variables - 如何根据 $JAVA_HOME 环境变量自动设置 Maven 编译器插件?
我正在使用 Maven 3.2.3。我有一个多模块项目,目前我的 Maven 编译器插件设置为这样
我想知道如何根据系统中的 $JAVA_HOME 变量设置编译器版本,这意味着,如果 $JAVA_HOME 指向 Java 6 安装,我的 Maven 编译器将使用“1.6”作为其源和目标。同样,如果我的 $JAVA_HOME 指向 Java 7 安装,则源和目标将是“1.7”,依此类推。如果环境中没有设置 $JAVA_HOME,我希望编译器默认为 1.6。
感谢您提供有关如何设置的建议和示例。
maven-3 - 如何为测试包含排除的源文件?
我有一个初始数据类,应该在正常(默认配置文件)构建中排除。如果我指定例如运行配置文件,则应包含此类。此外,测试需要这个类。所以它需要一直包含在内。
我使用排除项来实现第一部分,但是来自测试的依赖关系破坏了testCompile目标。
我的配置有什么问题?
有没有办法为测试包含排除的源文件?