java - 如何用Xlint编译Maven项目

标签 java maven compilation

有没有办法通过命令行将编译器参数传递给 Maven?我知道我可以在 compiler-plugin 中指定它,但我想运行 Xlint 同样来自命令行。所以我尝试了类似的东西

mvn clean install -DskipTests=true -DcompilerArgument=-Xlint:deprecation

但没有成功。

最佳答案

对于这个具体案例(弃用警告),实际上一个property which can be used from the command line :

mvn clean install -Dmaven.compiler.showDeprecation=true

与 compilerArgument 解决方案相反,这在 maven 进程内部使用编译器时也有效,而不仅仅是在使用 fork=true 时。

一个类似有用的属性是 maven.compiler.showWarnings

关于java - 如何用Xlint编译Maven项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18653947/

相关文章:

java - 使用spring Mapper映射Map对象 - Java

java - 如何使 BLOB 在 Oracle 和 PostgreSQL 上工作?

java - java中的字符串无法与星号(*)匹配

java - 无法加载 sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo

java - 尝试使用 Maven 在 JOOQ 中实现 EnumConverter 时出错

kotlin - 为什么在Kotlin中可以将高阶函数的扩展函数参数作为常规函数调用?

gcc - C 编译器无法创建可执行文件 Ubuntu 10.04 LTS

Java URI 类 : constructor determines whether or not query is encoded?

php - 是否有可用的 XSLT 到 C++ 编译器?

java - 使用 maven 安装 microsoft sqljdbc 驱动程序