How to include a shared artifact into another build job within a plan
Asked by Raymond Lee:

Hello,

I have searched many articles in web (including some posts about sharing artifact in this community), but I still cannot figure out what's wrong with my bamboo build plan, and hope to get advice from professionals here)

I have a project which involves two war projects, one war project (A) depends on another project (B) in build process. However, in the web, I only find a solution such the generate project B into a jar file (and also generates a war as well when building websphere EAR), and then war project (A) can build with project (B) jar and result in project (A) war. Final EAR is composed of two WARs together.

In local maven, I can build the EAR without problem. However, in bamboo, I encounter many errors in build process. In web, someone suggests that I need to build project (B) as a shared artifact (i.e. jar) and then last build job can include this artifact as a source together with the project source code to build final EAR.

I really have no idea how to proceed next, would any expert here give me some directions for me ?

Thanks a lot in advance,

Ray

------

Build POO - Build (Web Service) - Build Package #7 (POOWS-POOBUILDWS-UT-7) started building on agent Default Agent  

Build working directory is D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT  
Executing build POO - Build (Web Service) - Build Package #7 (POOWS-POOBUILDWS-UT-7)  
Preparing artifact 'POO2_IL-classes.jar' for use at ./  
Artifact 'POO2_IL-classes.jar' prepared in 181.1 ms at D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT  
Preparing artifact 'Source Codes' for use at ./  
Artifact 'Source Codes' prepared in 2.562 s at D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT  
Running pre-build action: VCS Version Collector  
Starting task 'Package ear' of type 'com.atlassian.bamboo.plugins.maven:task.builder.mvn3'

\[INFO\] Scanning for projects...  
\[WARNING\]  
\[WARNING\] Some problems were encountered while building the effective model for appothers-POO-IL:appothers-POO-IL:war:1.0.0-SNAPSHOT  
\[WARNING\] 'dependencies.dependency.systemPath' for AIAHK-WebServiceUtility:AIAHK-WebServiceUtility:jar should not point at files within the project directory, ${basedir}/WebContent/WEB-INF/lib/AIAHK-WebServiceUtility.jar will be unresolvable by dependent projects @ line 41, column 25  
\[WARNING\]  
\[WARNING\] It is highly recommended to fix these problems because they threaten the stability of your build.  
\[WARNING\]  
\[WARNING\] For this reason, future Maven versions might no longer support building such malformed projects.  
\[WARNING\]  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Reactor Build Order:  
\[INFO\]  
\[INFO\] appothers-POO-IL  
\[INFO\] appothers-POO-GN16  
\[INFO\] appothers-POO-ILEAR  
\[INFO\] appothers-POO  
\[INFO\]  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Building appothers-POO-IL 1.0.0-SNAPSHOT  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\]  
\[INFO\] --- maven-clean-plugin:2.5:clean (default-clean) @ appothers-POO-IL ---  
\[INFO\] Deleting D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\target  
\[INFO\]  
\[INFO\] --- maven-resources-plugin:2.6:resources (default-resources) @ appothers-POO-IL ---  
\[INFO\] Using 'UTF-8' encoding to copy filtered resources.  
\[INFO\] Copying 0 resource  
\[INFO\] skip non existing resourceDirectory D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\resources  
\[INFO\]  
\[INFO\] --- maven-compiler-plugin:3.1:compile (default-compile) @ appothers-POO-IL ---  
\[INFO\] Changes detected - recompiling the module!  
\[INFO\] Compiling 135 source files to D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\target\\classes  
\[WARNING\] Note: Some input files use unchecked or unsafe operations.  
\[WARNING\] Note: Recompile with -Xlint:unchecked for details.  
\[INFO\]  
\[INFO\] --- maven-resources-plugin:2.6:testResources (default-testResources) @ appothers-POO-IL ---  
\[INFO\] Using 'UTF-8' encoding to copy filtered resources.  
\[INFO\] skip non existing resourceDirectory D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\src\\test\\resources  
\[INFO\]  
\[INFO\] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ appothers-POO-IL ---  
\[INFO\] No sources to compile  
\[INFO\]  
\[INFO\] --- maven-surefire-plugin:2.12.4:test (default-test) @ appothers-POO-IL ---  
\[INFO\] No tests to run.  
\[INFO\]  
\[INFO\] --- maven-war-plugin:2.3:war (default-war) @ appothers-POO-IL ---  
\[INFO\] Packaging webapp  
\[INFO\] Assembling webapp \[appothers-POO-IL\] in \[D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\target\\POO2_IL\]  
\[INFO\] Processing war project  
\[INFO\] Copying webapp resources \[D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\WebContent\]  
\[INFO\] Webapp assembled in \[1751 msecs\]  
\[INFO\] Building war: D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\target\\POO2_IL.war  
\[INFO\] Packaging classes  
\[INFO\] Building jar: D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-IL\\target\\POO2_IL-classes.jar  
\[INFO\]  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Building appothers-POO-GN16 1.0.0-SNAPSHOT  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\]  
\[INFO\] --- maven-clean-plugin:2.5:clean (default-clean) @ appothers-POO-GN16 ---  
\[INFO\]  
\[INFO\] --- maven-resources-plugin:2.6:resources (default-resources) @ appothers-POO-GN16 ---  
\[INFO\] Using 'UTF-8' encoding to copy filtered resources.  
\[INFO\] Copying 0 resource  
\[INFO\] skip non existing resourceDirectory D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\resources  
\[INFO\]  
\[INFO\] --- maven-compiler-plugin:3.1:compile (default-compile) @ appothers-POO-GN16 ---  
\[INFO\] Changes detected - recompiling the module!  
\[INFO\] Compiling 24 source files to D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\target\\classes  
\[INFO\] -------------------------------------------------------------  
\[ERROR\] COMPILATION ERROR :  
\[INFO\] -------------------------------------------------------------  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16PolicyValues.java:\[73,58\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16PolicyValues.java:73: cannot find symbol  
symbol : method getBasicAndFinancialInfo(java.lang.String)  
location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[65,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:65: cannot find symbol  
symbol : method getPolicyFullInfo(java.lang.String,boolean)  
location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[66,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:66: cannot find symbol  
symbol : method getPolicyFullInfo(java.lang.String,boolean,float,float,float,boolean)  
location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[72,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:72: cannot find symbol  
symbol : method getPolicyFullInfo(java.lang.String)  
location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[73,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:73: cannot find symbol  
symbol : method getPolicyFullInfo(java.lang.String,boolean,float,float,float)  
location: class com.aiab.poo.services.POOPolicyDetails  
\[INFO\] 5 errors  
\[INFO\] -------------------------------------------------------------  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Reactor Summary:  
\[INFO\]  
\[INFO\] appothers-POO-IL .................................. SUCCESS \[13.625s\]  
\[INFO\] appothers-POO-GN16 ................................ FAILURE \[3.298s\]  
\[INFO\] appothers-POO-ILEAR ............................... SKIPPED  
\[INFO\] appothers-POO ..................................... SKIPPED  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] BUILD FAILURE  
\[INFO\] ------------------------------------------------------------------------  
\[INFO\] Total time: 17.466s  
\[INFO\] Finished at: Wed May 03 00:00:32 CST 2017  
\[INFO\] Final Memory: 25M/60M  
\[INFO\] ------------------------------------------------------------------------  
\[ERROR\] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project appothers-POO-GN16: Compilation failure: Compilation failure:  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16PolicyValues.java:\[73,58\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16PolicyValues.java:73: cannot find symbol  
\[ERROR\] symbol : method getBasicAndFinancialInfo(java.lang.String)  
\[ERROR\] location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[65,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:65: cannot find symbol  
\[ERROR\] symbol : method getPolicyFullInfo(java.lang.String,boolean)  
\[ERROR\] location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[66,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:66: cannot find symbol  
\[ERROR\] symbol : method getPolicyFullInfo(java.lang.String,boolean,float,float,float,boolean)  
\[ERROR\] location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[72,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:72: cannot find symbol  
\[ERROR\] symbol : method getPolicyFullInfo(java.lang.String)  
\[ERROR\] location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] /D:/atlassian/bamboo-home/xml-data/build-dir/POOWS-POOBUILDWS-UT/appothers-POO-GN16/src/com/aiahk/poo/gn16/webservice/POOGn16Illustration.java:\[73,66\] D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT\\appothers-POO-GN16\\src\\com\\aiahk\\poo\\gn16\\webservice\\POOGn16Illustration.java:73: cannot find symbol  
\[ERROR\] symbol : method getPolicyFullInfo(java.lang.String,boolean,float,float,float)  
\[ERROR\] location: class com.aiab.poo.services.POOPolicyDetails  
\[ERROR\] -\> \[Help 1\]  
\[ERROR\]  
\[ERROR\] To see the full stack trace of the errors, re-run Maven with the -e switch.  
\[ERROR\] Re-run Maven using the -X switch to enable full debug logging.  
\[ERROR\]  
\[ERROR\] For more information about the errors and possible solutions, please read the following articles:  
\[ERROR\] \[Help 1\] <http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException>  
\[ERROR\]  
\[ERROR\] After correcting the problems, you can resume the build with the command  
\[ERROR\] mvn \<goals\> -rf :appothers-POO-GN16  
Failing task since return code of \[D:\\Tools\\apache-maven-3.1.1\\bin\\mvn.bat --batch-mode -Djava.io.tmpdir=D:\\atlassian\\Bamboo\\temp\\POOWS-POOBUILDWS-UT -f appothers-POO\\pom.xml clean package\] was 1 while expected 0  
Finished task 'Package ear' with result: Failed  
Running post build plugin 'NCover Results Collector'  
Running post build plugin 'Artifact Copier'  
Running post build plugin 'npm Cache Cleanup'  
Running post build plugin 'Clover Results Collector'  
Running post build plugin 'Docker Container Cleanup'  
Successfully removed working directory at 'D:\\atlassian\\bamboo-home\\xml-data\\build-dir\\POOWS-POOBUILDWS-UT'  
Finalising the build...  
Stopping timer.  
Build POOWS-POOBUILDWS-UT-7 completed.  
Running on server: post build plugin 'NCover Results Collector'  
Running on server: post build plugin 'Build Hanging Detection Configuration'  
Running on server: post build plugin 'Clover Delta Calculator'  
Running on server: post build plugin 'Maven Dependencies Postprocessor'  
All post build plugins have finished  
Generating build results summary...  
Saving build results to disk...  
Logging substituted variables...  
Indexing build results...  
Finished building POOWS-POOBUILDWS-UT-7.


Answers:
author: Jennifer Yu
body: Did you check "Copying 0 resource ," in your log?

comments: author: Raymond Lee
body: Hi Jennifier,

Thanks for your feedback. May I know if the build action shows the artifact is copied (more than 1 resource), then the Bamboo then knows need to include this (classes.jar) into its build path when building final projection ?

Thanks,

Ray


author: Jennifer Yu
body: <https://confluence.atlassian.com/bamboo/sharing-artifacts-359400060.html>


Tags: artefact

share