2017-12-13 16 views
0

テストケースが実行されていないため、mavenプロジェクトをビルドできません。 私はエラー以下になります。私のPOMはこのテストケースの実行に失敗したため、mavenプロジェクトをビルドできません

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
    JBoss, Home of Professional Open Source 
    Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual 
    contributors by the @authors tag. See the copyright.txt in the 
    distribution for a full listing of individual contributors. 

    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 
    http://www.apache.org/licenses/LICENSE-2.0 
    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
--> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 


    <profiles> 
     <!-- This section contains the properties that may vary from environment to environment. 
      They are activated via profiles. --> 

     <!-- Properties for use of variables, which shall be replaced by real values before deployment --> 
     <profile> 
      <id>var</id> 
      <activation> 
       <activeByDefault>true</activeByDefault> 
      </activation> 
      <properties> 
       <isp.rin.ds.url>@@[email protected]@</isp.rin.ds.url> 
       <isp.rin.ds.user>@@[email protected]@</isp.rin.ds.user> 
       <isp.rin.ds.pwd>@@[email protected]@</isp.rin.ds.pwd> 

       <isp.rin.ds.host>@@[email protected]@</isp.rin.ds.host> 
       <isp.rin.ds.port>@@[email protected]@</isp.rin.ds.port> 
       <isp.rin.ds.db>@@[email protected]@</isp.rin.ds.db> 

       <isp.rin.activemq.transaction-support>@@[email protected]@</isp.rin.activemq.transaction-support> 
       <isp.rin.activemq.server-url.primary>@@[email protected]@</isp.rin.activemq.server-url.primary> 
       <isp.rin.activemq.server-url.secondary>@@[email protected]@</isp.rin.activemq.server-url.secondary> 

       <isp.rin.logg.level>@@[email protected]@</isp.rin.logg.level> 
       <isp.rin.business.logg.level>@@[email protected]@</isp.rin.business.logg.level> 
       <isp.rin.message.logg.level>@@[email protected]@</isp.rin.message.logg.level> 
      </properties> 
     </profile> 

     <!-- Properties for local developer machine --> 
     <profile> 
      <id>dev</id> 
      <activation> 
       <activeByDefault>false</activeByDefault> 
      </activation> 
      <properties> 
       <isp.rin.ds.url>jdbc:edb://localhost:37450/rin</isp.rin.ds.url> 
       <isp.rin.ds.user>enterprisedb</isp.rin.ds.user> 
       <isp.rin.ds.pwd>admin</isp.rin.ds.pwd> 
       <isp.rin.ds.host>localhost</isp.rin.ds.host> 
       <isp.rin.ds.port>37450</isp.rin.ds.port> 
       <isp.rin.ds.db>dss</isp.rin.ds.db> 

       <isp.rin.activemq.transaction-support>LocalTransaction</isp.rin.activemq.transaction-support> 
       <isp.rin.activemq.server-url.primary>tcp://localhost:61616</isp.rin.activemq.server-url.primary> 
       <isp.rin.activemq.server-url.secondary>tcp://localhost:61616</isp.rin.activemq.server-url.secondary> 


       <isp.rin.logg.level>DEBUG</isp.rin.logg.level> 
       <isp.rin.business.logg.level>DEBUG</isp.rin.business.logg.level> 
       <isp.rin.message.logg.level>INFO</isp.rin.message.logg.level> 

      </properties> 
     </profile> 
    </profiles> 

    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.postnord.rin</groupId> 
    <artifactId>rin-parent</artifactId> 
    <version>1.4.0</version> 
    <packaging>pom</packaging> 
    <name>Parent project for rin-parent</name> 

    <licenses> 
     <license> 
      <name>Apache License, Version 2.0</name> 
      <distribution>repo</distribution> 
      <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> 
     </license> 
    </licenses> 

    <modules> 
     <module>rin-common</module> 
     <module>rin-xsd</module> 
     <module>rin</module> 
     <module>rin-ear</module> 
    </modules> 

    <properties> 
     <!-- Explicitly declaring the source encoding eliminates the following message: --> 
     <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered 
       resources, i.e. build is platform dependent! --> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 

     <!-- JBoss dependency versions --> 

     <version.jboss.maven.plugin>7.3.Final</version.jboss.maven.plugin> 
       <!-- Define the version of JBoss' Java EE 6 APIs and Tools we want to import. --> 
       <!-- Certified version of the JBoss EAP components we want to use --> 
     <version.jboss.bom>1.0.2.Final-redhat-1</version.jboss.bom> 
     <!-- 
     <version.jboss.as>7.2.0.Final</version.jboss.as> 
     Alternatively, comment out the above line, and un-comment the 
      line below to use version 7.2.0.Final-redhat-8 which is a release certified 
      to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 
      maven repository. --> 
     <!-- --><version.jboss.as>7.2.0.Final-redhat-8</version.jboss.as> 

     <!-- 
     <version.jboss.spec.javaee.6.0>3.0.2.Final</version.jboss.spec.javaee.6.0> 
     Alternatively, comment out the above line, and un-comment the 
      line below to use version 3.0.2.Final-redhat-3 which is a release certified 
      to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 
      maven repository. --> 
     <!-- <version.jboss.spec.javaee.6.0>3.0.1.Final-redhat-3</version.jboss.spec.javaee.6.0> --> 
     <version.jboss.spec.javaee.6.0>3.0.1.Final-redhat-1</version.jboss.spec.javaee.6.0> 

     <!-- other plugin versions --> 
     <version.compiler.plugin>2.3.2</version.compiler.plugin> 
     <version.surefire.plugin>2.4.3</version.surefire.plugin> 
     <version.ear.plugin>2.6</version.ear.plugin> 
     <version.ejb.plugin>2.3</version.ejb.plugin> 
     <version.war.plugin>2.1.1</version.war.plugin> 
     <junit-version>4.12</junit-version> 

     <!-- maven-compiler-plugin --> 
     <maven.compiler.plugin>3.5.1</maven.compiler.plugin> 
     <maven.compiler.target>1.7</maven.compiler.target> 
     <maven.compiler.source>1.7</maven.compiler.source> 
     <maven.release.plugin>2.5.3</maven.release.plugin> 
     <maven.failsafe.plugin>2.19.1</maven.failsafe.plugin> 
     <maven.surefire.plugin>2.19.1</maven.surefire.plugin> 
     <jaxb2.maven.plugin.version>1.3</jaxb2.maven.plugin.version> 

     <RIN.BITC.Name>RegisterItemNotifierBitC-${project.version}</RIN.BITC.Name> 
     <RIN.PLE.Name>RinPLE-${project.version}</RIN.PLE.Name> 
     <RIN.DB.PLE.Name>RinDbPLE-${project.version}</RIN.DB.PLE.Name> 
     <RIN.LOG.PLE.Name>RinLogPLE-${project.version}</RIN.LOG.PLE.Name> 
     <RIN.EAR.Name>rin</RIN.EAR.Name> 
     <sonar.plugin.version>2.7</sonar.plugin.version> 
     <sonar.java.codeCoveragePlugin>jacoco</sonar.java.codeCoveragePlugin> 
     <sonar.junit.reportsPath>${basedir}/target/surefire-reports</sonar.junit.reportsPath> 
     <sonar.language>java</sonar.language> 
     <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding> 
     <jacoco.version>0.7.6.201602180812</jacoco.version> 
     <sonar-jacoco-listeners.version>1.4</sonar-jacoco-listeners.version> 
     <jacoco.outputDir>${basedir}/target/jacoco</jacoco.outputDir> 
     <jacoco.out.ut.file>jacoco-ut.exec</jacoco.out.ut.file> 
     <sonar.jacoco.reportPath>${jacoco.outputDir}/${jacoco.out.ut.file}</sonar.jacoco.reportPath> 
     <jacoco.out.it.file>jacoco-it.exec</jacoco.out.it.file> 
     <sonar.jacoco.itReportPath>${jacoco.outputDir}/${jacoco.out.it.file}</sonar.jacoco.itReportPath> 

     <maven.build.helper.plugin.version>1.9</maven.build.helper.plugin.version> 

    </properties> 

    <dependencyManagement> 
     <dependencies> 

      <!-- Define the version of the EJB jar so that we don't need 
       to repeat ourselves in every module --> 
      <dependency> 
       <groupId>com.postnord.rin</groupId> 
       <artifactId>rin</artifactId> 
       <!--<version>0.0.1-SNAPSHOT</version>--> 
       <version>${project.version}</version> 
       <type>ejb</type> 
      </dependency> 

         <!-- Define the version of JBoss' Java EE 6 APIs we want to import. 
       Any dependencies from org.jboss.spec will have their version defined by this 
       BOM --> 
      <!-- JBoss distributes a complete set of Java EE 6 APIs including 
       a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or 
       a collection) of artifacts. We use this here so that we always get the correct 
       versions of artifacts. Here we use the jboss-javaee-6.0 stack (you can 
       read this as the JBoss stack of the Java EE 6 APIs). You can actually 
       use this stack with any version of JBoss AS that implements Java EE 6, not 
       just JBoss AS 7! --> 
      <!-- <dependency> 
       <groupId>org.jboss.spec</groupId> 
       <artifactId>jboss-javaee-6.0</artifactId> 
       <version>${version.jboss.spec.javaee.6.0}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> --> 

      <!-- JBoss distributes a complete set of Java EE 6 APIs including 
       a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or 
       a collection) of artifacts. We use this here so that we always get the correct 
       versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack 
       (you can read this as the JBoss stack of the Java EE 6 APIs, with some extras 
       tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate 
       stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras 
       from the Hibernate family of projects) --> 
      <dependency> 
       <groupId>org.jboss.bom</groupId> 
       <artifactId>jboss-javaee-6.0-with-tools</artifactId> 
       <version>${version.jboss.bom}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
      <dependency> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-failsafe-plugin</artifactId> 
<version>${maven.failsafe.plugin}</version> 
<exclusions> 
<exclusion> 
<groupId>org.slf4j</groupId> 
<artifactId>slf4j-jdk14</artifactId> 
</exclusion> 
<exclusion> 
<groupId>org.slf4j</groupId> 
<artifactId>slf4j-nop</artifactId> 
</exclusion> 
</exclusions> 
</dependency> 
      <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>${junit-version}</version> 
      <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.jboss.bom</groupId> 
       <artifactId>jboss-javaee-6.0-with-hibernate</artifactId> 
       <version>${version.jboss.bom}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
      <dependency> 
      <groupId>org.codehaus.sonar-plugins.java</groupId> 
      <artifactId>sonar-jacoco-listeners</artifactId> 
      <version>${sonar-jacoco-listeners.version}</version> 
      <scope>test</scope> 
     </dependency> 
       <dependency> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>${maven.surefire.plugin}</version> 
     </dependency> 

     </dependencies> 
    </dependencyManagement> 
<distributionManagement> 
     <repository> 
      <id>libs-release-local</id> 
      <name>libs-release-local</name> 
      <url>http://ella-neserv2.idp.posten.se:37081/artifactory/libs-release-local</url> 
     </repository> 
<snapshotRepository> 
      <id>libs-snapshot-local</id> 
      <name>libs-snapshot-local</name> 
      <url>http://ella-neserv2.idp.posten.se:37081/artifactory/libs-snapshot-local</url> 
     </snapshotRepository> 
</distributionManagement> 
    <build> 
     <pluginManagement> 
      <plugins> 
       <!-- Compiler plugin enforces Java 1.6 compatibility and 
        activates annotation processors --> 
       <plugin> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <version>${version.compiler.plugin}</version> 
        <configuration> 
         <source>${maven.compiler.source}</source> 
         <target>${maven.compiler.target}</target> 
        </configuration> 
       </plugin> 
       <!-- The JBoss AS plugin deploys your ear to a local JBoss 
        AS container --> 
       <!-- Due to Maven's lack of intelligence with EARs we need 
        to configure the jboss-as maven plugin to skip deployment for all modules. 
        We then enable it specifically in the ear module. --> 
       <plugin> 
        <groupId>org.jboss.as.plugins</groupId> 
        <artifactId>jboss-as-maven-plugin</artifactId> 
        <version>${version.jboss.maven.plugin}</version> 
        <inherited>true</inherited> 
        <configuration> 
         <skip>true</skip> 
        </configuration> 
       </plugin> 
       <plugin> 
       <artifactId>maven-eclipse-plugin</artifactId> 
       <version>2.7</version> 
       <configuration> 
        <downloadSources>true</downloadSources> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>${maven.surefire.plugin}</version> 
       <configuration> 
        <argLine>${jacoco.agent.ut.arg}</argLine> 
        <!-- Specific to generate mapping between tests and covered code --> 
        <properties> 
         <property> 
          <name>listener</name> 
          <value>org.sonar.java.jacoco.JUnitListener</value> 
         </property> 
        </properties> 
        <!-- test failure ignore --> 
        <testFailureIgnore>true</testFailureIgnore> 
       </configuration> 
      </plugin> 
      <plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-compiler-plugin</artifactId> 
<version>${maven.compiler.plugin}</version> 
<configuration> 
<source>${maven.compiler.source}</source> 
<target>${maven.compiler.target}</target> 
</configuration> 
</plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-failsafe-plugin</artifactId> 
       <version>${maven.failsafe.plugin}</version> 
       <configuration> 
        <argLine>-Xmx1024m -XX:MaxPermSize=256m ${jacoco.agent.it.arg} 
        </argLine> 
        <!-- Specific to generate mapping between tests and covered code --> 
        <properties> 
         <property> 
          <name>listener</name> 
          <value>org.sonar.java.jacoco.JUnitListener</value> 
         </property> 
        </properties> 
        <!-- Let's put failsafe reports with surefire to have access to tests 
         failures/success reports in sonar --> 
        <reportsDirectory>${project.build.directory}/surefire-reports 
        </reportsDirectory> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.jacoco</groupId> 
       <artifactId>jacoco-maven-plugin</artifactId> 
       <version>${jacoco.version}</version> 
       <executions> 
        <!-- Prepares a variable, jacoco.agent.ut.arg, that contains the info 
         to be passed to the JVM hosting the code being tested. --> 
        <execution> 
         <id>prepare-ut-agent</id> 
         <phase>process-test-classes</phase> 
         <goals> 
          <goal>prepare-agent</goal> 
         </goals> 
         <configuration> 
          <destFile>${sonar.jacoco.reportPath}</destFile> 
          <propertyName>jacoco.agent.ut.arg</propertyName> 
          <append>true</append> 
         </configuration> 
        </execution> 
        <!-- Prepares a variable, jacoco.agent.it.arg, that contains the info 
         to be passed to the JVM hosting the code being tested. --> 
        <execution> 
         <id>prepare-it-agent</id> 
         <phase>pre-integration-test</phase> 
         <goals> 
          <goal>prepare-agent</goal> 
         </goals> 
         <configuration> 
          <destFile>${sonar.jacoco.itReportPath}</destFile> 
          <propertyName>jacoco.agent.it.arg</propertyName> 
          <append>true</append> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 

      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>sonar-maven-plugin</artifactId> 
       <version>${sonar.plugin.version}</version> 
      </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
</project> 

ように見える


Forking command line: cmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_80\jre\bin\java" -XX:-UseSplitVerifier -jar D:\Ankush\Codes\RIN\0537-logistics-bit-c-rin\main\rin\rin-common\target\surefire\surefirebooter8137375113015923041.jar D:\Ankush\Codes\RIN\0537-logistics-bit-c-rin\main\rin\rin-common\target\surefire\surefire2656883459599824975tmp D:\Ankush\Codes\RIN\0537-logistics-bit-c-rin\main\rin\rin-common\target\surefire\surefire_083819702813080247tmp" 
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null 
java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 
at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:130) 
at org.apache.maven.surefire.booter.SurefireReflector.instantiateProvider(SurefireReflector.java:239) 
at org.apache.maven.surefire.booter.ProviderFactory.createProvider(ProviderFactory.java:122) 
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:81) 
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103) 
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74) 
Caused by: org.apache.maven.surefire.util.SurefireReflectionException: java.lang.ClassNotFoundException: org.sonar.java.jacoco.JUnitListener; nested exception is java.lang.ClassNotFoundException: org.sonar.java.jacoco.JUnitListener 
at org.apache.maven.surefire.util.ReflectionUtils.loadClass(ReflectionUtils.java:236) 
at org.apache.maven.surefire.util.ReflectionUtils.instantiate(ReflectionUtils.java:109) 
at org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory.createCustomListeners(JUnit4RunListenerFactory.java:43) 
at org.apache.maven.surefire.junit4.JUnit4Provider.<init>(JUnit4Provider.java:81) 
... 10 more 
Caused by: java.lang.ClassNotFoundException: org.sonar.java.jacoco.JUnitListener 
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 
at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:97) 
at org.apache.maven.surefire.util.ReflectionUtils.loadClass(ReflectionUtils.java:228) 
... 13 more 

同じエラーを私はそこにもジェンキンスに取得していますだけでなく、私は、ビルドを実行することができないと私はテストケースをスキップする必要がありますバージョンは正しいですし、私は他のmavenプロジェクトにもチェックしました POMは正常に見えますが、この問題は決して他のコンポーネントビルドにはありません。

+0

mvn clean install -Uコマンドを使用してmavenプロジェクトをクリーンアップしましたか? ClassNotFoundExceptionは、クラスの定義が存在しない場合に発生します。 –

答えて

0

あなたは非常に古いsonar-maven-pluginを使用しています。あなたは、このプラグインに変更する必要があります。

<!-- https://mvnrepository.com/artifact/org.sonarsource.scanner.maven/sonar-maven-plugin --> 
<plugin> 
    <groupId>org.sonarsource.scanner.maven</groupId> 
    <artifactId>sonar-maven-plugin</artifactId> 
    <version>3.4.0.905</version> 
</plugin> 

...とあなたは確実なの<dependency>すぎ

そしてadditionnally(それが確実なために利用できるようにしなければならないため)はいとしてそれを宣言する必要がある場合、私はわからないんだけど、あなたは

+0

それは私のために働いていません。 :( –

0

<plugins>にあなたがそれを「アクティブ」を<pluginManagement>が実際にそれを使用せずに、グローバルプラグインを設定する方法です。)あなたは<dependencyManagement>sonar-jacoco-listeners依存関係を設定し<plugins>にこの定義を含める必要があります。この依存関係をビルドパス(ClassNotFoundExceptionを避ける)にするには、対応するモジュールの<build><dependencies>...</dependencies/></build>に定義する必要があります。違いを理解してください:this postthe docを参照してください。

このプロジェクトは他のプロジェクトの親会社のようです。 Sonarはあなたの子プロジェクト(あなたのモジュールの1つ)によって効果的に実行されますので、sonar-jacoco-listenersをこれらのモジュールの依存として定義し、それを親の依存関係管理に入れておく必要があります。

関連する問題