Tag: maven

如何使Sonar忽略codeCoverage指标的一些类?

我在Maven有一个声纳配置文件。 除代码覆盖率指标外,一切正常。 我想让Sonar只为代码覆盖率指标忽略一些类。 我有以下个人资料: sonar **/beans/jaxb/** org.apache.maven.plugins maven-surefire-plugin ${maven.surefire.plugin.version} true **/*Suite*.java **/*RemoteTest.java **/*SpringTest.java **/*CamelTest.java **/*FunctionalTest.java **/*IntegrationTest.java **/*DaoBeanTest.java 请帮忙。 我试着添加类似的东西 com/qwerty/dw/publisher/Main.class 但它没有帮助 UPDATE 我有一个正确的Cobertura配置文件。 我试图将它添加到Sonar配置文件中,但我仍然有53%而不是Cobertura配置文件中的95% sonar **/beans/jaxb/** cobertura org.apache.maven.plugins maven-surefire-plugin ${maven.surefire.plugin.version} true **/*Suite*.java **/*RemoteTest.java **/*SpringTest.java **/*CamelTest.java **/*FunctionalTest.java **/*IntegrationTest.java **/*DaoBeanTest.java org.codehaus.mojo cobertura-maven-plugin ${cobertura.maven.plugin.version} com/qwerty/dw/dao/* com/qwerty/dw/domain/* com/qwerty/dw/beans/**/* com/qwerty/dw/daemon/exception/* com/qwerty/dw/daemon/Main.class com/qwerty/dw/sink/Main.class com/qwerty/dw/publisher/Main.class com/qwerty/dw/publisher/dao/* com/qwerty/dw/publisher/domain/* html true true 60 60 […]

在Eclipse IDE中使用maven / m2e从.proto自动生成Java

对于我的团队,我想配置maven / eclipse构建以从*.proto文件(在使用gRPC的项目中)自动生成Java代码。 目前需要运行mvn generate-source或mvn protobuf:compile (如插件使用页面 )。 或者什么是相同的添加运行配置来调用maven目标compile 。 每当Eclipse Maven项目刷新( Alt + F5 )或IDE重新启动时,项目都会重建,但不会出现在target/generated ,从而将项目变为红色。 因此需要生成并刷新项目( F5 )。 更新Eclipse需要在.clathpath文件中配置源文件夹。 据我所知,应该是m2e连接器,但我只能找到一个https://github.com/masterzen/m2e-protoc-connector,用于最早的Google s plugin com.google.protobuf.tools:maven-protoc-plugin ,甚至在https://github.com/grpc/grpc-java上都没有提到 我们使用完全引用/推荐 org.xolstice.maven.plugins protobuf-maven-plugin 那是: kr.motd.maven os-maven-plugin 1.4.1.Final org.xolstice.maven.plugins protobuf-maven-plugin 0.5.0 com.google.protobuf:protoc:3.1.0:exe:${os.detected.classifier} grpc-java io.grpc:protoc-gen-grpc-java:1.0.1:exe:${os.detected.classifier} compile compile-custom 有关: 链接到Eclipse中生成的Java protobuf代码 看了这个,但是那个作者正在使用其他较旧的,现在不支持的插件: 由protobuf生成的代码引起的Eclipse构建循环(与Maven Project Builder相关) PPS插件https://github.com/igor-petruk/protobuf-maven-plugin但是有继续https://github.com/os72/protoc-jar-maven-plugin

Maven中相同依赖的不同版本

我有一个依赖于Woodstox和XStream的maven项目。 不幸的是,XStream还依赖于Woodstox,但版本略高于我的需要。 与此同时,Woodstox库的工件名称发生了变化,因此maven不会将它们视为同一工件的多个版本。 但是包和类名是相同的,这意味着在运行时存在冲突。 现在,我可以在某种程度上破坏构造中的旧woodstox jar(在我们的案例中是一个war文件)但是解决这类问题的正确方法是什么?

Maven在同一个编译过程中预处理和生成类的示例?

有没有人在编译时预先处理类注释的maven项目有一个干净的例子,后续生成的类将在同一个编译过程中编译? 有没有人有一个逐步的程序来实现这样的项目?

将所有Maven依赖项添加到Arquillian

如何将POM中的所有依赖项添加到arquillian? Maven.resolver().loadPomFromFile(“pom.xml”).importRuntimeDependencies() .as(File.class); 我找到了那条线,但是我在Maven中的红色是因为它找不到类。 我不知道我需要哪些依赖项。 还是有更好的方法?

使用Maven在IntelliJ中构建时解决PermGen错误?

如果我在使用Maven在IntelliJ中构建我的项目时从应用服务器获得PermGen OutOfMemoryError,那么Maven使用的堆应该增加吗? 我使用Win7,8GB RAM,当我用maven重建项目时,我从appserver获得了PermGen。

调试surefire的策略“分叉的虚拟机终止而没有说再见。 VM崩溃或System.exit调用?“

我正在开发一个相当复杂的java项目,它有许多依赖项和许多unit testing。 我在mac(mavericks)上使用java 1.6.0_65,使用maven 3.0.5和maven-surefire-plugin:2.16在几个forks中运行。 我的问题是,使用多个forks运行此设置会导致fork退出: “分叉的虚拟机在没有说再见的情况下终止。虚拟机崩溃或System.exit被调用?” 只使用一个fork运行它不会产生问题(并且一切都通过) 有一些关于这个问题的信息,包括这个StackOverflow问题和这个万无一失的bug (现在似乎已经解决了) 我知道这种情况的“答案”是在我的代码中找到什么叫System.exit() – 我找不到任何东西。 或者是什么原因导致我的JVM崩溃 – 没有hs_pid崩溃报告。 我的问题是我可以用什么样的策略找到找到这个原因的? 为了澄清,我对上面提到的答案不感兴趣,但是找到它的起源。 (或者甚至更好地说明可能导致此问题的不同答案) 我的Surefire配置是:(但我确实尝试过其他组合) classes 1 1C false false true true true alphabetical 在使用–debug(-X)运行maven目标后添加#1添加相关的输出 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project event-logger: ExecutionException; nested exception is java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM […]

使用web.xml配置嵌入式jetty?

我试图用我的Web应用程序生成一个战争以及一个带有嵌入式jetty的自包含jar文件。 对于嵌入式jetty(jar文件分发),我添加一个servlet,如下所示: public static void main(String[] args) throws Exception { Server server = new Server(8080); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath(“/”); server.setHandler(context); context.addServlet(new ServletHolder(new HelloServlet()),”/*”); server.start(); server.join(); } war文件分发使用web.xml文件,该文件在web-app部分中包含以下内容: com.example.HelloServlet SimplestServer HelloServlet /* 这很有效。 但是,我想摆脱两种方法之间的重复。 即,当我添加一个新的servlet时,我想要只在一个位置配置它。 我可以从嵌入式jetty加载和使用web.xml文件吗?

Netbeans Maven项目不将Main Class添加到Manifest

我对这个问题有类似的问题。 我已经尝试了列出的所有建议,但仍然处于亏损状态。 我的问题是我正在尝试构建一个maven项目并将其分发给其他机器,但jar文件没有填充正确的Manifest。 每次构建和运行时,我都会收到以下错误: no main manifest attribute, in myjar.jar 。 我需要编辑某种配置文件吗? 我只是不知道发生了什么。 我也试过这个修复 ,但无济于事。

如何在嵌入eclipse的maven资源库中安装jar?

我的目标是在Maven存储库中安装一个jar文件。 这篇文章解释了如何使用MVN进行安装。 但是因为我在Eclipse中嵌入了Maven,所以我不知道在哪里运行以下命令: mvn install:install-file -Dfile=C:\lib\rest\WadlGenerator.jar \ -DgroupId=foo.in.shop.rest.wadl \ -DartifactId=WadlGenerator \ -Dversion=1.0 \ -Dpackaging=jar \ -DlocalRepositoryPath=C:\maven\repositories\internal 简而言之:如何识别Eclipse嵌入式Maven的Maven安装目录?