小编Tom*_*Tom的帖子

Maven依赖树 - 加号(+)vs反斜杠(\)

mvn dependency-tree"+"和"\"之间输出的区别是什么.对我来说这似乎相当武断,但我确信它不是......

+- com.tom:artifact:pom:6.0.0:compile
|  +- com.tom:artifact2:jar:1.0.4:compile
|  \- com.tom:artifact3:jar:6.0.0:compile
|     \- (com.tom:artifact4:jar:1.0.4:compile - omitted for duplicate)
Run Code Online (Sandbox Code Playgroud)

[我显然删除了实际的组/工件ID ...]

maven maven-dependency-plugin

10
推荐指数
1
解决办法
1545
查看次数

使用 Maven Invoker API 时在 DefaultInitationRequest 上设置 InputStream

我正在尝试使用 Maven 调用程序 API 以交互模式调用其他 Maven 插件,但交互模式在 InvocableRequest 上没有设置 InputStream 时失败。此时有没有办法检索控制台提示符?

InvocationRequest invocationRequest = new DefaultInvocationRequest();
invocationRequest.setPomFile("/some/pom/file/pom.xml");
// set up goals etc
invocationRequest.setInteractive(true);
// Here I need to add the input stream: eg invocationRequest.setInputStream(???);

Invoker invoker = new DefaultInvoker();
InvocationResult result = invoker.execute(invocationRequest);
Run Code Online (Sandbox Code Playgroud)

如果没有输入流,调用的目标就无法完成。


编辑[一点说明]:InvocableRequest 对象上有一个 .setInputStream 方法。如果请求是交互式的,DefaultInvoker 将检查是否已设置。

if ( request.isInteractive() ) {
    if ( inputStream == null ) {
        getLogger().warn("Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.");
        // …
Run Code Online (Sandbox Code Playgroud)

maven-2 maven-plugin maven

5
推荐指数
0
解决办法
1530
查看次数