我在我的一个模块中通过JaCoCo生成AHP报告时遇到了麻烦.构建开始时,我看到JaCoCo正确设置了argLine:
[INFO] jacoco.agent.argLine set to -javaagent:<...>/.m2/repository/org/jacoco/org.jacoco.agent/0.7.2.201409121644/org.jacoco.agent-0.7.2.201409121644-runtime.jar=destfile=<...>/target/jacoco.exec
Run Code Online (Sandbox Code Playgroud)
但是,maven尝试运行JaCoCo时尚未创建.exec:
[INFO] Skipping JaCoCo execution due to missing execution data file:<...>/target/jacoco.exec
Run Code Online (Sandbox Code Playgroud)
在maven跳过JaCoCo执行后,jacoco.exec最终会被创建.因此,如果我在没有清理的情况下重新运行构建,我仍然可以生成AHP报告.
我已经在其他各种问题中看到,我需要小心使用Maven Surefire和JaCoCo.但是,我没有在我的Surefire插件或任何插件中明确使用argLine.我开始怀疑其他插件之一是否像JaCoCo一样自动劫持argLine参数.
以下是使用的所有插件的列表:
我确实在构建输出中看到一条可疑消息:
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ <module> ---
[INFO] Changes detected - recompiling the module!
Run Code Online (Sandbox Code Playgroud)
我不确定这是否相关,但它在跳过消息之前出现了两次,并且没有出现在JaCoCo正常工作的模块中.
有任何想法吗?
*编辑 - 这是jacoco配置
<plugins>
<...>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This …Run Code Online (Sandbox Code Playgroud) 我正在运行火星4.5.1.内容辅助在lamba表达式的代码块中根本不起作用.
obj.doSomething(param1 -> {
// Content Assist doesn't work here
}
Run Code Online (Sandbox Code Playgroud)
代码块之外的任何内容自动完成.例如:param1会正确显示内容辅助.
它应该在4.5.0中修复,但对我来说似乎并非如此.
当我尝试通过取消选中"使用默认合规性设置" 手动设置1.8兼容性时,每次退出首选项时都会重新启用该框.编译器合规性级别设置为1.8,无济于事.
我在eclipse(Mars)中尝试使用Subversive插件和SVNKit连接器比较 - > Base from Working Copy时收到以下错误消息:
SVN: '0x00400103: Compare with Revision' operation finished with error: svn: E195000: A path under version control is needed for this operation
svn: E195000: A path under version control is needed for this operation
Run Code Online (Sandbox Code Playgroud)
我的SVN密码最近更改了,IIRC最近安装了一些与subversion相关的更新,作为定期Eclipse插件更新的一部分.我不确定两者是否相关.
我已经进入了SVN Repository Exploring视图,并清除了我的位置属性,正如我在其他密码更改线程中看到的那样,这让我再次访问了存储库,但是没有解决这个问题.我也尝试删除我的%AppData%/ Roaming/Subversion/auth/svn.simple/*缓存的配置数据无济于事.
有人有主意吗?
*编辑 - 我更新了我的SVN连接器以使用Native JavaHL 1.8.14.听起来我需要JavaHL for Windows 7 x64.与来自工作副本的Base相比仍然不起作用,但与Repository中的 - > Latest进行比较确实有效.
我有很多方法想用相同的 try/catch 处理来包装。我认为 lambdas 可以在这里帮助我,但我很难弄清楚语法。
这是我要实现的目标的背景。
method1(..., result -> method2(result, ...));
Run Code Online (Sandbox Code Playgroud)
方法 2 是方法 1 结果的处理程序。我想用一个通用的 try/catch 语句包装 method2,该语句对大量处理程序来说是通用的,而不必将该语句复制/粘贴到所有处理程序。
注意:这些是未经检查的异常。
*edit - 我正在尝试做的具体例子。
我正在使用 Vert.x,他们使用通用的 Handlers 设计模式。这是他们的 SQL 接口的示例
query(String sql, Handler<AsyncResult<ResultSet>> resultHandler)
Run Code Online (Sandbox Code Playgroud)
Handler是一个简单的1个函数接口:
void handle(E event)
Run Code Online (Sandbox Code Playgroud)
所以基本上,执行“sql”中定义的查询,并将结果发送到resultHandler。下面是一个使用中的例子:
connection.query("SELECT * from table1", asyncResult -> {
// do something with results
}
Run Code Online (Sandbox Code Playgroud)
以上使用了他们文档的标准编码风格。由于各种原因,我个人更喜欢在命名函数中处理结果,因此它更改为:
connection.query("SELECT * from table1", asyncResult -> method1(asyncResult));
void method1(AsyncResult<ResultSet> asyncResult) {
// do something with results
}
Run Code Online (Sandbox Code Playgroud)
我无法控制 query() 接口,所以我坚持使用这种模式。我不确定 Tagir 的解决方案是否适用于这种情况,但我会在早上尝试一下。
*edit2 - 我应该注意到我试图将上面示例中的 method1 包装在异常包装器中,所以理想情况下,我会在 query() …