2016-04-15 129 views
1

我使用的是Atlassian Bamboo和Maven 3插件。當我推送我的代碼並構建項目時,它似乎沒有創建一個jar,因此它不能發佈它。你可以看到我的日誌和POM這裏MAVEN構建不生成jar

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://[email protected]: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://[email protected]: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://[email protected]: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://[email protected]: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://[email protected]: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文件是錯誤的地方,還是我做錯了什麼?

更新:新增日誌和pom.xml中到後

+0

最好是張貼日誌輸出爲文本而不是圖片...會導致一些人被限制... – khmarbaise

回答

2

Maven使用建階段,如comile,測試,封裝和安裝。

你的構建似乎只有在「測試」階段纔會執行。 封裝階段,這通常會按照測試階段,永遠不會在你的情況下執行。

試圖改變自己改變你的配置來運行「命令mvn全新安裝」爲例。

這個答案也可以幫助你:Bamboo: how to produce maven artifact

+1

我剛剛意識到,我必須說明它在「目標」。謝謝! –

1

事實證明,我沒有MAVEN目標指定「包」。可以通過構建計劃的「配置計劃」菜單來完成。

enter image description here

相關問題