mvn如何编译源码命令_java – 如何使用maven编译单个文件?

据我所知,这在命令行中是不可能的.值得注意的是,您可以定义用于在pom.xml中配置Compiler Plugin的(可选)参数

excludes和

includes,如下所示:

$mvn help:describe -Dcmd=compiler:compile -Ddetail

[INFO] Scanning for projects...

[INFO] Searching repository for plugin with prefix: 'help'.

[INFO] ------------------------------------------------------------------------

[INFO] Building sandbox

[INFO] task-segment: [help:describe] (aggregator-style)

[INFO] ------------------------------------------------------------------------

[INFO] [help:describe {execution: default-cli}]

[INFO] 'compiler:compile' is a plugin goal (aka mojo).

Mojo: 'compiler:compile'

compiler:compile

Description: Compiles application sources

Deprecated. No reason given

Implementation: org.apache.maven.plugin.CompilerMojo

Language: java

Bound to phase: compile

Available parameters:

...

excludes

A list of exclusion filters for the compiler.

Deprecated. No reason given

...

includes

A list of inclusion filters for the compiler.

Deprecated. No reason given

...

所以实际上没有真正的方法可以长期做你想做的事.

但这导致了一个问题.由于Maven使用增量编译,即它只编译自上次构建以来在磁盘上更改的类,为什么还需要只编译一个类?你的用例是什么?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值