Maven / Jenkins - 从Jenkins运行Maven的麻烦

时间:2013-08-07 10:15:00

标签: maven ant jenkins jmeter

所以我有一个运行Jenkins的项目,它调用Maven,它调用Ant(不要问为什么)运行一系列JMeter测试。

我知道Ant和JMeter的工作正常。我遇到的问题是在尝试添加Maven时。

我调用了pom.xml,它简单地引用了ant build.xml文件。我得到的错误如下:

Started by user anonymous
Building in workspace C:\Users\MURPHYA1\.jenkins\jobs\JMeter-Running-Mavin\workspace
Parsing POMs
Discovered a new module JMeter-Running-Maven:JMeter-Running-Maven JMeter-Running-Maven
Modules changed, recalculating dependency graph
[workspace] $ java -cp "C:\Users\MURPHYA1\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.4.jar;C:\Users\MURPHYA1\Desktop\Code samples\apache-maven-3.1.0-bin\apache-maven-3.1.0\boot\plexus-classworlds-2.4.2.jar" jenkins.maven3.agent.Maven31Main "C:\Users\MURPHYA1\Desktop\Code samples\apache-maven-3.1.0-bin\apache-maven-3.1.0" C:\Users\MURPHYA1\.jenkins\war\WEB-INF\lib\remoting-2.30.jar C:\Users\MURPHYA1\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.4.jar C:\Users\MURPHYA1\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.4.jar 56391
<===[JENKINS REMOTING CAPACITY]===>channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven:  -B -f C:\Users\MURPHYA1\.jenkins\jobs\JMeter-Running-Mavin\workspace\pom.xml run
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Scanning for projects...
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener -                                                                         
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Building JMeter-Running-Maven 1.0-SNAPSHOT
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -                                                                         
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building JMeter-Running-Maven 1.0-SNAPSHOT
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - BUILD FAILURE
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Total time: 0.749s
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Finished at: Wed Aug 07 11:10:02 BST 2013
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Final Memory: 3M/61M
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[JENKINS] Archiving C:\Users\MURPHYA1\.jenkins\jobs\JMeter-Running-Mavin\workspace\pom.xml to C:\Users\MURPHYA1\.jenkins\jobs\JMeter-Running-Mavin\modules\JMeter-Running-Maven$JMeter-Running-Maven\builds\2013-08-07_11-09-52\archive\JMeter-Running-Maven\JMeter-Running-Maven\1.0-SNAPSHOT\JMeter-Running-Maven-1.0-SNAPSHOT.pom
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 4.863s
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: Wed Aug 07 11:10:06 BST 2013
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 3M/61M
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
channel stopped
Finished: FAILURE

我的pom.xml如下:

<project>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>JMeter-Running-Maven</artifactId>
  <groupId>JMeter-Running-Maven</groupId>
  <version>1.0-SNAPSHOT</version>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <configuration>
              <tasks>           
                <ant antfile="${basedir}/build.xml">
                    <target name="prepare-JMeter-Running-Maven" />
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

有人能够指出我哪里出错吗? 感谢

更新

我在客户端VDI机器上运行它,我遇到运行mvn install等命令的问题,这给了我错误,例如连接被拒绝:禁止和超时。你认为这是问题,还是我的pom.xml不正确?

1 个答案:

答案 0 :(得分:1)

所以问题是vdi阻止我下载相关的jar和pom文件。所以我所做的是在本地机器上运行任务,将文件复制到我的vdi repo和jar文件,我使用以下maven命令注册它们:

mvn install:install-file -Dfile=.\lib\com.ibm.mq.jar -DgroupId=com.ibm.mq -DartifactId=WebsphereMQClassesForJava -Dversion=7.0.1.5 -Dpackaging=jar