MAVEN build不会生成jar

时间:2016-04-15 11:41:46

标签: maven build bamboo

我正在使用Atlassian Bamboo和Maven 3插件。当我推送我的代码并构建项目时,它似乎没有创建一个jar,因此它无法发布它。你可以在这里看到我的日志和pom

https://gist.github.com/bozmen/d842d9a3f9cb9b73559caa5658d11c27

或在这里

// log

simple  15-Apr-2016 14:33:36    Build MavenTest - Merge - Build Job #51 (MERGE-MERGE-JOB1-51) started building on agent Second Local Agent
simple  15-Apr-2016 14:33:36    
simple  15-Apr-2016 14:33:36    Build working directory is /opt/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1
simple  15-Apr-2016 14:33:36    Executing build MavenTest - Merge - Build Job #51 (MERGE-MERGE-JOB1-51)
simple  15-Apr-2016 14:33:36    Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
simple  15-Apr-2016 14:33:36    Updating source code to revision: 23b69330c4527209f95f1b4c3aa1f0a7db70cc55
simple  15-Apr-2016 14:33:36    Fetching 'refs/heads/master' from 'ssh://git@stash.solveka.com.tr:7999/merge/maventest.git'.
simple  15-Apr-2016 14:33:36    Warning: Permanently added '[127.0.0.1]:38549' (RSA) to the list of known hosts.
simple  15-Apr-2016 14:33:37    Checking out revision 23b69330c4527209f95f1b4c3aa1f0a7db70cc55.
simple  15-Apr-2016 14:33:37    Previous HEAD position was add3546... fsg
simple  15-Apr-2016 14:33:37    HEAD is now at 23b6933... gsdfgsdg
simple  15-Apr-2016 14:33:37    Updated source code to revision: 23b69330c4527209f95f1b4c3aa1f0a7db70cc55
simple  15-Apr-2016 14:33:37    Finished task 'Checkout Default Repository' with result: Success
simple  15-Apr-2016 14:33:37    Running pre-build action: VCS Version Collector
simple  15-Apr-2016 14:33:37    Starting task 'Build' of type 'com.atlassian.bamboo.plugins.maven:task.builder.mvn3'
command 15-Apr-2016 14:33:37    Beginning to execute external process for build 'MavenTest - Merge - Build Job #51 (MERGE-MERGE-JOB1-51)'\n ... running command line: \n/usr/local/maven/bin/mvn --batch-mode -Djava.io.tmpdir=/opt/atlassian/bamboo/temp/MERGE-MERGE-JOB1 clean test\n ... in: /opt/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1\n ... using extra environment variables: \nbamboo_planRepository_1_branch=master\nbamboo_repository_revision_number=23b69330c4527209f95f1b4c3aa1f0a7db70cc55\nMAVEN2_HOME=/usr/local/maven\nbamboo_resultsUrl=https://bamboo.solveka.com.tr/browse/MERGE-MERGE-JOB1-51\nbamboo_capability_system_jdk_JDK8=/usr/java/sunjdk8\nbamboo_capability_system_jdk_JDK7=/usr/java/sunjdk7\nbamboo_repository_9764866_name=MavenTest\nbamboo_planRepository_1_name=MavenTest\nbamboo_build_working_directory=/opt/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1\nbamboo_buildKey=MERGE-MERGE-JOB1\nbamboo_repository_9764866_git_username=\nbamboo_shortPlanName=Merge\nbamboo_planRepository_name=MavenTest\nbamboo_repository_9764866_branch_name=master\nbamboo_buildNumber=51\nbamboo_shortJobName=Build Job\nbamboo_buildResultsUrl=https://bamboo.solveka.com.tr/browse/MERGE-MERGE-JOB1-51\nbamboo_planRepository_repositoryUrl=ssh://git@stash.solveka.com.tr:7999/merge/maventest.git\nbamboo_capability_system_builder_command_mkdir=/bin/mkdir\nbamboo_agentId=7929857\nbamboo_planName=MavenTest - Merge\nbamboo_capability_system_jdk_JDK_1_8_0_40=/usr/java/latest\nbamboo_shortPlanKey=MERGE\nbamboo_shortJobKey=JOB1\nbamboo_planRepository_revision=23b69330c4527209f95f1b4c3aa1f0a7db70cc55\nbamboo_repository_previous_revision_number=add354668126e0c70ad8ac30b217a439afe40d21\nbamboo_buildTimeStamp=2016-04-15T14:33:36.362+03:00\nbamboo_repository_9764866_revision_number=23b69330c4527209f95f1b4c3aa1f0a7db70cc55\nbamboo_planRepository_previousRevision=add354668126e0c70ad8ac30b217a439afe40d21\nM2_HOME=/usr/local/maven\nbamboo_buildResultKey=MERGE-MERGE-JOB1-51\nbamboo_repository_git_branch=master\nbamboo_repository_branch_name=master\nbamboo_buildPlanName=MavenTest - Merge - Build Job\nbamboo_planRepository_1_revision=23b69330c4527209f95f1b4c3aa1f0a7db70cc55\nbamboo_repository_name=MavenTest\nJAVA_HOME=/usr/java/latest\nbamboo_planRepository_branch=master\nbamboo_agentWorkingDirectory=/opt/atlassian/home/bamboo/xml-data/build-dir\nbamboo_capability_system_git_executable=/usr/bin/git\nbamboo_planRepository_1_previousRevision=add354668126e0c70ad8ac30b217a439afe40d21\nbamboo_repository_git_username=\nbamboo_repository_9764866_git_repositoryUrl=ssh://git@stash.solveka.com.tr:7999/merge/maventest.git\nbamboo_planRepository_1_type=stash-rep\nbamboo_planRepository_branchName=master\nbamboo_repository_9764866_previous_revision_number=add354668126e0c70ad8ac30b217a439afe40d21\nbamboo_capability_system_builder_command_atlas_mvn=/opt/atlassian-plugin-sdk/bin/atlas-mvn\nbamboo_planRepository_type=stash-rep\nbamboo_planRepository_1_username=\nbamboo_repository_git_repositoryUrl=ssh://git@stash.solveka.com.tr:7999/merge/maventest.git\nbamboo_repository_9764866_git_branch=master\nuseMavenReturnCode=false\nbamboo_capability_system_builder_mvn3_Maven_3=/usr/local/maven\nbamboo_working_directory=/opt/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1\nbamboo_planKey=MERGE-MERGE\nbamboo_planRepository_1_repositoryUrl=ssh://git@stash.solveka.com.tr:7999/merge/maventest.git\nbamboo_planRepository_username=\nbamboo_capability_system_jdk_JDK_1_8=/usr/java/latest\nbamboo_planRepository_1_branchName=master\nPATH=/usr/java/latest/bin:/sbin:/usr/sbin:/bin:/usr/bin\n
build   15-Apr-2016 14:33:40    [INFO] Scanning for projects...
build   15-Apr-2016 14:33:40    [INFO]                                                                         
build   15-Apr-2016 14:33:40    [INFO] ------------------------------------------------------------------------
build   15-Apr-2016 14:33:40    [INFO] Building maventest 1.0-SNAPSHOT
build   15-Apr-2016 14:33:40    [INFO] ------------------------------------------------------------------------
build   15-Apr-2016 14:33:40    [INFO] 
build   15-Apr-2016 14:33:40    [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ maventest ---
build   15-Apr-2016 14:33:40    [INFO] Deleting /data/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1/target
build   15-Apr-2016 14:33:40    [INFO] 
build   15-Apr-2016 14:33:40    [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ maventest ---
build   15-Apr-2016 14:33:40    [debug] execute contextualize
build   15-Apr-2016 14:33:40    [INFO] Using 'UTF-8' encoding to copy filtered resources.
build   15-Apr-2016 14:33:40    [INFO] skip non existing resourceDirectory /data/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1/src/main/resources
build   15-Apr-2016 14:33:40    [INFO] 
build   15-Apr-2016 14:33:40    [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ maventest ---
build   15-Apr-2016 14:33:40    [INFO] Compiling 1 source file to /data/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1/target/classes
build   15-Apr-2016 14:33:40    [INFO] 
build   15-Apr-2016 14:33:40    [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ maventest ---
build   15-Apr-2016 14:33:40    [debug] execute contextualize
build   15-Apr-2016 14:33:40    [INFO] Using 'UTF-8' encoding to copy filtered resources.
build   15-Apr-2016 14:33:40    [INFO] skip non existing resourceDirectory /data/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1/src/test/resources
build   15-Apr-2016 14:33:40    [INFO] 
build   15-Apr-2016 14:33:40    [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ maventest ---
build   15-Apr-2016 14:33:40    [INFO] Compiling 1 source file to /data/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1/target/test-classes
build   15-Apr-2016 14:33:41    [INFO] 
build   15-Apr-2016 14:33:41    [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ maventest ---
build   15-Apr-2016 14:33:41    [INFO] Surefire report directory: /data/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1/target/surefire-reports
build   15-Apr-2016 14:33:41    
build   15-Apr-2016 14:33:41    -------------------------------------------------------
build   15-Apr-2016 14:33:41     T E S T S
build   15-Apr-2016 14:33:41    -------------------------------------------------------
build   15-Apr-2016 14:33:41    Running MERGE.maventest.AppTest
build   15-Apr-2016 14:33:41    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.034 sec
build   15-Apr-2016 14:33:41    
build   15-Apr-2016 14:33:41    Results :
build   15-Apr-2016 14:33:41    
build   15-Apr-2016 14:33:41    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
build   15-Apr-2016 14:33:41    
build   15-Apr-2016 14:33:41    [INFO] ------------------------------------------------------------------------
build   15-Apr-2016 14:33:41    [INFO] BUILD SUCCESS
build   15-Apr-2016 14:33:41    [INFO] ------------------------------------------------------------------------
build   15-Apr-2016 14:33:41    [INFO] Total time: 3.029s
build   15-Apr-2016 14:33:41    [INFO] Finished at: Fri Apr 15 14:33:41 EEST 2016
build   15-Apr-2016 14:33:41    [INFO] Final Memory: 17M/144M
build   15-Apr-2016 14:33:41    [INFO] ------------------------------------------------------------------------
simple  15-Apr-2016 14:33:41    Parsing test results under /opt/atlassian/home/bamboo/xml-data/build-dir/MERGE-MERGE-JOB1...
simple  15-Apr-2016 14:33:41    Finished task 'Build' with result: Success
simple  15-Apr-2016 14:33:41    Running post build plugin 'NCover Results Collector'
simple  15-Apr-2016 14:33:41    Running post build plugin 'Artifact Copier'
simple  15-Apr-2016 14:33:41    Publishing an artifact: JAR file
error   15-Apr-2016 14:33:41    Unable to publish artifact [JAR file]: 
simple  15-Apr-2016 14:33:41    The artifact hasn't been successfully published after 0s
simple  15-Apr-2016 14:33:41    Running post build plugin 'npm Cache Cleanup'
simple  15-Apr-2016 14:33:41    Running post build plugin 'Clover Results Collector'
simple  15-Apr-2016 14:33:41    Running post build plugin 'Docker Container Cleanup'
simple  15-Apr-2016 14:33:41    Finalising the build...
simple  15-Apr-2016 14:33:41    Stopping timer.
simple  15-Apr-2016 14:33:41    Build MERGE-MERGE-JOB1-51 completed.
simple  15-Apr-2016 14:33:41    Running on server: post build plugin 'NCover Results Collector'
simple  15-Apr-2016 14:33:41    Running on server: post build plugin 'Build Hanging Detection Configuration'
simple  15-Apr-2016 14:33:41    Running on server: post build plugin 'Clover Delta Calculator'
simple  15-Apr-2016 14:33:42    Running on server: post build plugin 'Maven Dependencies Postprocessor'
simple  15-Apr-2016 14:33:42    All post build plugins have finished
simple  15-Apr-2016 14:33:42    Generating build results summary...
simple  15-Apr-2016 14:33:42    Saving build results to disk...
simple  15-Apr-2016 14:33:42    Logging substituted variables...
simple  15-Apr-2016 14:33:42    Indexing build results...
simple  15-Apr-2016 14:33:42    Finished building MERGE-MERGE-JOB1-51.

// pom.xml
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>MERGE</groupId>
  <artifactId>maventest</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>maventest</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

和maven项目中的文件夹:

enter image description here

如何让它创建一个jar文件?我的java文件是在错误的地方还是我做错了什么?

更新:在帖子中添加了log和pom.xml

2 个答案:

答案 0 :(得分:2)

Maven使用构建阶段,例如comile,test,package和install。

您的构建似乎只会在&#34;测试&#34;之前执行。相。 在您的情况下,封装阶段通常会在测试阶段之后执行。

尝试更改您的配置更改以运行&#34; mvn clean install&#34;例如。

这个答案也可以帮到你:Bamboo: how to produce maven artifact

答案 1 :(得分:1)

事实证明我没有在MAVEN目标中指定“包”。可以通过构建计划的“配置计划”菜单来执行此操作。

enter image description here