2013-09-09 2 views
0

Мне очень сложно настроить maven 3.0.4 для запуска всех тестов Junit от Jenkins. С Дженкинс этого Maven запуска команды «чистый развернуть -P местный» Согласно результату испытаний Jenkins будут пропущены:Настроить Jenkins/maven 3.0.4 для запуска всех модульных тестов

INFO: --- Maven-безошибочный-плагин: 2,10: тест (по умолчанию-тест) @ тест-партии --- [INFO] Тесты пропускаются

самое странное в том, что на местном уровне (от затмения) с помощью команды Maven «чистую установку (профиль локального)» все тесты JUnit в настоящее время запущен. Ни один из тестов Junit не пропущен.

Я понятия не имею, почему существует разница между Дженкинсом и затмением. Я настраиваю pom.xml для запуска всех тестов. Я просмотрел документацию по плагину surefire: test и google, но я не нашел решения этой проблемы.

<plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-compiler-plugin</artifactId> 
         <version>2.1</version> 
         <configuration> 
          <source>${java.version}</source> 
          <target>${java.version}</target> 
          <skipTests>false</skipTests> 
         </configuration> 
        </plugin> 



    And 

    <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-plugin</artifactId> 
         <configuration> 
          <skipTests>false</skipTests> 
          <includes> 
          <include>**/Test*.java</include> 
          <include>**/*Test.java</include> 
          </includes> 
         </configuration> 
         <executions> 
          <execution> 
          <id>default-test</id> 
          <configuration> 
           <skip>false</skip> 
          </configuration> 
          </execution> 
         </executions> 

        </plugin> 

Здесь вся pom.xml используется для этого проекта:

<?xml version="1.0" encoding="UTF-8"?> 
    <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"> 
     <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <groupId>com.projet.maven</groupId> 
     <artifactId>pom-corporate</artifactId> 
     <version>1.5</version> 
    </parent> 



    <groupId>com.projet.test</groupId> 
    <artifactId>test</artifactId> 
    <version>1.0.0</version> 
    <packaging>pom</packaging> 
    <name>${project.artifactId}(${project.packaging})</name> 
    <url>http://${project.artifactId}.projet.com/${config.siteUrl}</url> 

    <properties> 
     <test.version.package>2.2.1</test.version.package> 
     <testws.version.package>2.2.1</testws.version.package> 
     <testcommun.version.package>2.2.1</testcommun.version.package> 
     <java.version>1.6</java.version> 
     <java.version>1.6</java.version> 
     <spring.version>2.5.6</spring.version> 
     <wicket.version>1.4.18</wicket.version> 
     <cxf.version>2.1.8</cxf.version> 
     <project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding> 
     <config.siteUrl>website/${project.artifactId}-${project.version}</config.siteUrl> 
     <config.siteFullUrl>sftp://projet.com/home/groups/${project.artifactId}/htdocs/${config.siteUrl}</config.siteFullUrl> 
     <config.cargoRemoteUri>service:jmx:rmi:///jndi/rmi://${config.jonasJmxServer}:${config.jonasJmxPort}/jrmpconnector_${config.cargoJonasDomainName}</config.cargoRemoteUri> 
     <persistence.batch>classpath:META-INF/persistence-batch.xml</persistence.batch> 
     <persistence.war>classpath:META-INF/persistence-mysql.xml</persistence.war> 
    </properties> 



    <scm> 
     <connection>scm:svn:https://projet.com/svnroot/${project.artifactId}/trunk</connection> 
     <developerConnection>scm:svn:https://projet.com/svnroot/${project.artifactId}/trunk</developerConnection> 
    </scm> 

    <!-- test resolution proxy issue --> 
     <pluginRepositories> 
     <pluginRepository> 
      <releases> 
       <enabled>true</enabled> 
       <updatePolicy>never</updatePolicy> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
       <updatePolicy>never</updatePolicy> 
      </snapshots> 
      <id>Nexus internal</id> 
      <url>http://projet.com:8080/nexus/content/groups/public/</url> 
     </pluginRepository> 
     <pluginRepository> 
      <releases> 
       <enabled>true</enabled> 
       <updatePolicy>never</updatePolicy> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
       <updatePolicy>never</updatePolicy> 
      </snapshots> 
      <id>central</id> 
      <name>Maven Plugin Repository</name> 
      <url>http://repo1.maven.org/maven2</url> 
     </pluginRepository> 
    </pluginRepositories> 

    <repositories> 
     <repository> 
      <id>Nexus releases</id> 
      <url>http:// projet.com:8080/nexus/content/repositories/releases/</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>Nexus snapshots</id> 
      <url>projet.com:8080/nexus/content/repositories/snapshots/</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 


    <!-- Site deployment --> 
    <distributionManagement> 
     <repository> 
      <id>Nexus internal</id> 
      <name>Nexus repo</name> 
      <url>http:// projet.com:8080/nexus/content/repositories/releases/</url> 
     </repository> 
     <snapshotRepository> 
      <id>Nexus snapshots</id> 
      <name>Nexus Snapshot Repository</name> 
      <url> projet.com:8080/nexus/content/repositories/snapshots/</url> 
     </snapshotRepository> 
    </distributionManagement> 

    <dependencyManagement> 
     <dependencies> 

      <!-- ===================== --> 
      <!-- application libraries --> 
      <!-- ===================== --> 



      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-model</artifactId> 
       <version>${test.version.package}</version> 
       <type>jar</type> 
      </dependency> 

      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-application</artifactId> 
       <version>${test.version.package}</version> 
       <type>jar</type> 
      </dependency> 

      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-business</artifactId> 
       <version>${test.version.package}</version> 
       <type>jar</type> 
      </dependency> 

      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-consumer-jpa</artifactId> 
       <version>${test.version.package}</version> 
       <type>jar</type> 
      </dependency> 

      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-provider-wicket</artifactId> 
       <version>${test.version.package}</version> 
       <type>jar</type> 
      </dependency> 

      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-war</artifactId> 
       <version>${test.version.package}</version> 
       <type>war</type> 
      </dependency> 

      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-ear</artifactId> 
       <version>${test.version.package}</version> 
       <classifier>${config.classifier}</classifier> 
       <type>ear</type> 
      </dependency> 




      <!-- =================== --> 
      <!-- framework libraries --> 
      <!-- =================== --> 

      <!-- Spring dependencies --> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-core</artifactId> 
       <version>${spring.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-web</artifactId> 
       <version>${spring.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <!-- spring-aop only needed in runtime --> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-aop</artifactId> 
       <version>${spring.version}</version> 
       <scope>runtime</scope> 
      </dependency> 
      <!-- spring-tx includes transaction, JCA, DAO --> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-tx</artifactId> 
       <version>${spring.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <!-- spring-jdbc includes commons-exceptions, datasource management --> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-jdbc</artifactId> 
       <version>${spring.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-context</artifactId> 
       <version>${spring.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <!-- spring-orm includes Hibernate and JPA support --> 
      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-orm</artifactId> 
       <version>${spring.version}</version> 
       <scope>compile</scope> 
      </dependency> 

      <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-test</artifactId> 
       <version>2.5.6</version> 
       <scope>test</scope> 
      </dependency> 

      <!-- commons-logging is a Spring dependency which generate failures when Jonas is runing within Eclipse --> 
      <!-- so we remove this library using the provided scope --> 
      <dependency> 
       <groupId>commons-logging</groupId> 
       <artifactId>commons-logging</artifactId> 
       <version>1.1.1</version> 
       <scope>provided</scope> 
      </dependency> 

      <dependency> 
       <groupId>log4j</groupId> 
       <artifactId>log4j</artifactId> 
       <version>1.2.14</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>javax.servlet</groupId> 
       <artifactId>servlet-api</artifactId> 
       <version>2.4</version> 
       <scope>provided</scope> 
      </dependency> 

      <!-- wicket dependencies --> 
      <dependency> 
       <groupId>org.apache.wicket</groupId> 
       <artifactId>wicket</artifactId> 
       <version>${wicket.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.apache.wicket</groupId> 
       <artifactId>wicket-extensions</artifactId> 
       <version>${wicket.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.apache.wicket</groupId> 
       <artifactId>wicket-datetime</artifactId> 
       <version>${wicket.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.apache.wicket</groupId> 
       <artifactId>wicket-jmx</artifactId> 
       <version>${wicket.version}</version> 
       <scope>compile</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.apache.wicket</groupId> 
       <artifactId>wicket-spring</artifactId> 
       <version>${wicket.version}</version> 
       <scope>compile</scope> 
       <exclusions> 
        <exclusion> 
         <groupId>org.springframework</groupId> 
         <artifactId>spring</artifactId> 
        </exclusion> 
       </exclusions> 
      </dependency> 

      <!-- Gassi mock library --> 
      <dependency> 
       <groupId>com.projet.clara.component</groupId> 
       <artifactId>security</artifactId> 
       <version>3.0.0</version> 
      </dependency> 
      <dependency> 
       <groupId>commons-digester</groupId> 
       <artifactId>commons-digester</artifactId> 
       <version>1.6</version> 
      </dependency> 
      <!-- gassi jsp example uses jstl tags --> 
      <dependency> 
       <groupId>javax.servlet</groupId> 
       <artifactId>jstl</artifactId> 
       <version>1.2</version> 
       <scope>provided</scope> 
      </dependency> 

      <!-- Hibernate JPA dependency --> 
      <dependency> 
       <groupId>org.hibernate</groupId> 
       <artifactId>hibernate-core</artifactId> 
       <version>3.3.2.GA</version> 
       <scope>compile</scope> 
      </dependency> 

      <dependency> 
       <groupId>org.hibernate</groupId> 
       <artifactId>hibernate-entitymanager</artifactId> 
       <version>3.4.0.GA</version> 
       <scope>compile</scope> 
      </dependency> 

      <dependency> 
       <groupId>org.hibernate</groupId> 
       <artifactId>hibernate-annotations</artifactId> 
       <version>3.4.0.GA</version> 
       <scope>runtime</scope> 
      </dependency> 

      <!-- needed with jonas 5.1 --> 
      <dependency> 
       <groupId>org.hibernate</groupId> 
       <artifactId>hibernate-validator</artifactId> 
       <version>3.1.0.GA</version> 
       <scope>runtime</scope> 
      </dependency> 

      <!-- needed with jonas 5.1 --> 
      <dependency> 
       <groupId>org.hibernate</groupId> 
       <artifactId>hibernate-search</artifactId> 
       <version>3.1.0.GA</version> 
       <scope>runtime</scope> 
      </dependency> 

      <!-- slf4j is used by Wicket and Hibernate Annotations 3.4 --> 
      <dependency> 
       <groupId>org.slf4j</groupId> 
       <artifactId>slf4j-api</artifactId> 
       <version>1.5.6</version> 
      </dependency> 
      <dependency> 
       <groupId>org.slf4j</groupId> 
       <artifactId>slf4j-log4j12</artifactId> 
       <version>1.5.6</version> 
      </dependency> 

      <dependency> 
       <groupId>xml-apis</groupId> 
       <artifactId>xml-apis</artifactId> 
       <version>1.0.b2</version> 
       <scope>provided</scope> 
      </dependency> 

      <!-- J2EE 1.4 JPA 3.0 specification --> 
      <dependency> 
       <groupId>org.apache.geronimo.specs</groupId> 
       <artifactId>geronimo-jpa_3.0_spec</artifactId> 
       <version>1.1</version> 
       <scope>compile</scope> 
      </dependency> 

      <!-- hsqldb driver used for unit tests --> 
      <dependency> 
       <groupId>hsqldb</groupId> 
       <artifactId>hsqldb</artifactId> 
       <version>1.8.0.1</version> 
       <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>${project.groupId}</groupId> 
       <artifactId>test-batch</artifactId> 
       <version>${test.version.package}</version> 
      </dependency> 


     </dependencies> 
    </dependencyManagement> 

    <dependencies> 
     <!-- test dependencies are always included --> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <!-- Spring TestContext 2.5.6 only supports JUnit 4.4 
      see http://jira.springframework.org/browse/SPR-5145 --> 
      <version>4.4</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-all</artifactId> 
      <version>1.8.1</version> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <version>2.1</version> 
        <configuration> 
         <source>${java.version}</source> 
         <target>${java.version}</target> 
         <skipTests>false</skipTests> 
        </configuration> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-war-plugin</artifactId> 
        <version>2.2</version> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-dependency-plugin</artifactId> 
        <version>2.1</version> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-deploy-plugin</artifactId> 
        <version>2.5</version> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-ear-plugin</artifactId> 
        <version>2.4</version> 
        <configuration> 
         <version>1.4</version> 
         <classifier>${config.classifier}</classifier> 
        </configuration> 
       </plugin> 


       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-resources-plugin</artifactId> 
        <version>2.5</version> 
        <!-- required on continuous integration platform --> 
        <configuration> 
         <encoding>ISO-8859-15</encoding> 
        </configuration> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.cxf</groupId> 
        <artifactId>cxf-codegen-plugin</artifactId> 
        <version>2.2</version> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-eclipse-plugin</artifactId> 
        <version>2.7</version> 
        <configuration> 
         <downloadSources>true</downloadSources> 
        </configuration> 
       </plugin> 

       <plugin> 
        <groupId>org.codehaus.mojo</groupId> 
        <artifactId>sonar-maven-plugin</artifactId> 
        <version>1.0-beta-1</version> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-site-plugin</artifactId> 
        <version>2.0.1</version> 
        <configuration> 
         <inputEncoding>ISO-8859-15</inputEncoding> 
         <outputEncoding>UTF-8</outputEncoding> 
        </configuration> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-javadoc-plugin</artifactId> 
        <version>2.6.1</version> 
        <configuration> 
         <encoding>ISO-8859-15</encoding> 
         <javadocVersion>1.5</javadocVersion> 
        </configuration> 
        <executions> 
         <execution> 
          <id>aggregate</id> 
          <goals> 
           <goal>aggregate</goal> 
          </goals> 
          <phase>site</phase> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.codehaus.cargo</groupId> 
        <artifactId>cargo-maven2-plugin</artifactId> 
        <version>1.0</version> 
        <executions> 
         <execution> 
          <id>verify-deploy</id> 
          <phase>install</phase> 
          <goals> 
           <goal>deployer-redeploy</goal> 
          </goals> 
         </execution> 
        </executions> 

        <configuration> 
         <container> 
          <!-- For jonas 5 deployment, just replace with "jonas5x" --> 
          <containerId>jonas4x</containerId> 
          <type>remote</type> 
         </container> 
         <deployer> 
          <deployables> 
           <deployable> 
            <groupId>${project.groupId}</groupId> 
            <artifactId>${project.artifactId}</artifactId> 
            <type>${project.packaging}</type> 
            <classifier>${config.classifier}</classifier> 
           </deployable> 
          </deployables> 
         </deployer> 

         <configuration> 
          <type>runtime</type> 
          <properties> 
           <cargo.remote.uri>${config.cargoRemoteUri}</cargo.remote.uri> 
           <cargo.remote.username>${config.cargoRemoteUsername}</cargo.remote.username> 
           <cargo.remote.password>${config.cargoRemotePassword}</cargo.remote.password> 
           <cargo.jonas.server.name>${config.cargoJonasServerName}</cargo.jonas.server.name> 
           <cargo.jonas.domain.name>${config.cargoJonasDomainName}</cargo.jonas.domain.name> 
          </properties> 
         </configuration> 
        </configuration> 
       </plugin> 

       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <configuration> 
         <skipTests>false</skipTests> 
         <includes> 
         <include>**/Test*.java</include> 
         <include>**/*Test.java</include> 
         </includes> 
        </configuration> 
        <executions> 
         <execution> 
         <id>default-test</id> 
         <configuration> 
          <skip>false</skip> 
         </configuration> 
         </execution> 
        </executions> 

       </plugin> 

      </plugins> 
     </pluginManagement> 
    </build> 

    <reporting> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-javadoc-plugin</artifactId> 
       <version>2.4</version> 
       <configuration> 
        <aggregate>true</aggregate> 
       </configuration> 
       <reportSets> 
        <reportSet> 
         <id>html</id> 
         <reports> 
          <report>javadoc</report> 
          <report>test-javadoc</report> 
         </reports> 
        </reportSet> 
       </reportSets> 
      </plugin> 
     </plugins> 
    </reporting> 

    <profiles> 
     <profile> 
      <id>local</id> 
      <activation> 
       <activeByDefault>true</activeByDefault> 
      </activation> 
      <!-- choose this profile for local deployment on windows --> 
      <properties> 
       <config.classifier>LOCAL</config.classifier> 
       <config.jonasJmxServer>localhost</config.jonasJmxServer> 
       <config.jonasJmxPort>1099</config.jonasJmxPort> 
       <config.cargoRemoteUsername>jonas</config.cargoRemoteUsername> 
       <config.cargoRemotePassword>jonas</config.cargoRemotePassword> 

       <log.Extraction>erreurBatch.log</log.Extraction> 
       <server.name>localhost</server.name> 
       <file.security>/WEB-INF/security-config/security-config.xml</file.security> 
       <test.level>DEBUG</test.level> 
       <alt></alt> 
       <wicket.mode>development</wicket.mode> 
      </properties> 
     </profile> 
</profiles> 





    <modules> 
    <module>model</module> 
    <module>application</module> 
    <module>business</module> 
    <module>consumer-jpa</module> 
    </modules> 
</project> 
+0

Каков результат, если вы запустили 'mvn clean install' из командной строки? Испытываются ли тесты? –

+0

Испытания также пропущены с «mvn clean install -P local» от Jenkins. –

+0

Как вы локально строите свой проект? Используете ли вы eclipse или строите ли вы его из командной строки? Я просто хочу исключить случай, что это проблема затмения. Я предлагаю вам попытаться построить проект из командной строки и проанализировать журналы Maven для тестовых исполнений. –

ответ

0

ли вы пытаетесь указать следующее в вашей конфигурации верной?

<testSuite>plugin-symbolic-name-of-the-plugin-that-contains-your-tests</testSuite> 
<testClass>packagetoyourclasses.*Test*</testClass>