我有一个使用 MavenInvokerAPI 调用 Maven 运行的插件。一切工作正常,但我的 Maven 控制台输出中确实有此警告。
[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)
我在构建过程中不需要交互,并且根据 Javadoc setInputStream(),我将我设置inputStream为null,但我再次收到此警告:
/**
* Sets the input stream used to provide input for the invoked Maven build. This is in particular useful when
* invoking Maven in interactive mode.
*
* @param inputStream The input stream used to provide input for the invoked Maven build, may be <code>null</code> …Run Code Online (Sandbox Code Playgroud) 我想在Maven Invoker测试期间调低日志记录.现在,每个测试中的每个依赖项的序列Downloading和Downloaded每个依赖项都会对日志进行污染.
[INFO] [INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-grouper/2.19/surefire-grouper-2.19.jar
[INFO] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-grouper/2.19/surefire-grouper-2.19.jar (38 KB at 1292.5 KB/sec)
Run Code Online (Sandbox Code Playgroud)
我想保留所有其他日志,所以mvn -q不是一个选项.此外,--batch-mode隐藏只是下载进度,而不是Downloading和Downloaded日志.
以下是我的集成测试的目录结构
/src/it/first-test
-->my-test
-->build.log
-->inoker.properties
-->pom.xml
-->verify.groovy
Run Code Online (Sandbox Code Playgroud)
当我尝试按照https://maven.apache.org/plugins/maven-invoker-plugin/usage.html所述运行单个集成测试时。它给出了一条消息“没有选择执行项目”这是我用来调用项目的命令
/src/main> mvn invoker:run -Dinvoker.test=first-test/my-test*
Run Code Online (Sandbox Code Playgroud)
我应该如何确保测试运行?
两者的文档(Failsafe,Invoker)表明它们对于运行集成测试很有用.我无法弄清楚哪一个用于集成测试.
我能看到的唯一区别是Failsafe插件专门用于运行集成测试,而Invoker插件恰好对运行集成测试很有用,但其主要目的是其他方面.但是,当我在Eclipse中创建maven-plugin时,Maven Invoker插件已经包含在POM文件中,并带有以下代码.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.7</version>
<configuration>
<debug>true</debug>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<goals>
<goal>clean</goal>
<goal>test-compile</goal>
</goals>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
它们之间的主要区别是什么?是否存在特定情况,其中一个应优先于其他集成测试?
integration-testing maven-plugin maven maven-failsafe-plugin maven-invoker-plugin