• Icon: Suggestion Suggestion
    • Resolution: Tracked Elsewhere
    • None
    • Plan Branches
    • None
    • 0
    • 2
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      As new features are added to an application, it is sometimes necessary to change the command line of the build for certain branches to pass a new system property, etc.

      In addition, when upgrading an application to a new version of java, it would be useful to maintain release/master branches on the original version while the upcoming release and feature branches are run using a new jdk.

            [BAM-14839] Override JDK/Command line for plan branches

            I tried Samuel's suggestion and it doesn't work.  Here is the output:

             17-Sep-2016 13:58:39	Starting task 'Ant' of type 'com.atlassian.bamboo.plugins.ant:task.builder.ant'
            17-Sep-2016 13:58:39	
            Beginning to execute external process for build 'e911 - Nightly - Build #9 (E911-NN-JOB1-9)'
             ... running command line: 
            /usr/share/ant/bin/ant -Djava.io.tmpdir=/var/cache/tomcat6/temp/E911-NN-JOB1 -f build.xml -Dofficial="true" continuous-integration
             ... in: /var/bamboo/xml-data/build-dir/E911-NN-JOB1
             ... using extra environment variables: 
            ANT_OPTS=-Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m
            bamboo_java_home=/usr/lib64/jvm/java-1.8.0
            JAVA_HOME=${bamboo_java_home}
            ANT_HOME=/usr/share/ant
            PATH=${bamboo_java_home}/bin:/usr/share/tomcat6/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games
            17-Sep-2016 13:58:39	Buildfile: /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build.xml
            17-Sep-2016 13:58:51	javac-project:
            17-Sep-2016 13:58:51	    [mkdir] Created dir: /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build/classes
            17-Sep-2016 13:58:52	    [mkdir] Created dir: /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build/models
            17-Sep-2016 13:58:52	
            17-Sep-2016 13:58:52	BUILD FAILED
            17-Sep-2016 13:58:52	/var/bamboo/xml-data/build-dir/E911-NN-JOB1/build.xml:1468: Unable to find a javac compiler;
            17-Sep-2016 13:58:52	com.sun.tools.javac.Main is not on the classpath.
            17-Sep-2016 13:58:52	Perhaps JAVA_HOME does not point to the JDK.
            17-Sep-2016 13:58:52	It is currently set to "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre"
            

            You can see that the variables are correct and the path is correct but Bamboo doesn't use the correct JVM.

            Mark Thomas added a comment - I tried Samuel's suggestion and it doesn't work.  Here is the output:  17-Sep-2016 13:58:39 Starting task 'Ant' of type 'com.atlassian.bamboo.plugins.ant:task.builder.ant' 17-Sep-2016 13:58:39 Beginning to execute external process for build 'e911 - Nightly - Build #9 (E911-NN-JOB1-9)' ... running command line: /usr/share/ant/bin/ant -Djava.io.tmpdir=/var/cache/tomcat6/temp/E911-NN-JOB1 -f build.xml -Dofficial="true" continuous-integration ... in: /var/bamboo/xml-data/build-dir/E911-NN-JOB1 ... using extra environment variables: ANT_OPTS=-Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m bamboo_java_home=/usr/lib64/jvm/java-1.8.0 JAVA_HOME=${bamboo_java_home} ANT_HOME=/usr/share/ant PATH=${bamboo_java_home}/bin:/usr/share/tomcat6/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games 17-Sep-2016 13:58:39 Buildfile: /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build.xml 17-Sep-2016 13:58:51 javac-project: 17-Sep-2016 13:58:51 [mkdir] Created dir: /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build/classes 17-Sep-2016 13:58:52 [mkdir] Created dir: /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build/models 17-Sep-2016 13:58:52 17-Sep-2016 13:58:52 BUILD FAILED 17-Sep-2016 13:58:52 /var/bamboo/xml-data/build-dir/E911-NN-JOB1/build.xml:1468: Unable to find a javac compiler; 17-Sep-2016 13:58:52 com.sun.tools.javac.Main is not on the classpath. 17-Sep-2016 13:58:52 Perhaps JAVA_HOME does not point to the JDK. 17-Sep-2016 13:58:52 It is currently set to "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre" You can see that the variables are correct and the path is correct but Bamboo doesn't use the correct JVM.

            Wouldn't it make much more sense to allow the Build Plan / Job / Requirements to be configurable per-branch, and then set JAVA_HOME according the the requirement for 'JDK', 'JDK 1.7', etc.? This would allow you to configure a maintenance branch to keep building under JDK 7, with a path agnostic plan (as JAVA_HOME would be set by the value of the matching capability on the build agent), and then have your main/trunk build use JDK 8 or 9 using the same method (defined at the parent level in the plan).

            Trevor Horsfall added a comment - Wouldn't it make much more sense to allow the Build Plan / Job / Requirements to be configurable per-branch, and then set JAVA_HOME according the the requirement for 'JDK', 'JDK 1.7', etc.? This would allow you to configure a maintenance branch to keep building under JDK 7, with a path agnostic plan (as JAVA_HOME would be set by the value of the matching capability on the build agent), and then have your main/trunk build use JDK 8 or 9 using the same method (defined at the parent level in the plan).

            Here is a workaround for the JDK part: you can simply declare java.home as a variable of the plan, and add the following in the Environment variable field of the task:

            JAVA_HOME=${bamboo.java.home}
            

            This way, you can override this variable in branches, to set the path to a different JDK.

            It's not very pretty, but it works

            Samuel Langlois added a comment - Here is a workaround for the JDK part: you can simply declare java.home as a variable of the plan, and add the following in the Environment variable field of the task: JAVA_HOME=${bamboo.java.home} This way, you can override this variable in branches, to set the path to a different JDK. It's not very pretty, but it works

            I have a project with Java 8 code in the trunk and two maintainance branches running with Java 7. I want to switch the capability so that JDK thw branches keep building with JDK 7 while trunk uses JDK 8. Seems like a common problem for me.

            Kathleen Neumann added a comment - I have a project with Java 8 code in the trunk and two maintainance branches running with Java 7. I want to switch the capability so that JDK thw branches keep building with JDK 7 while trunk uses JDK 8. Seems like a common problem for me.

            Not different systems. A scenario for this would be:
            An existing application is upgraded to new version of Java which requires a series of code changes. Those code changes would be on a trunk/master branch while we would still be building the release branches. It would be useful in this case to set a different JDK for each branch.

            In this case, we could clone the plan and maintain 2 separate copies of it but this is cumbersome when all we really need is to override the JDK and command line for the branch.

            Essentially what we are looking for is the ability to override things on the Task page for a given branch.

            Daniel Camero added a comment - Not different systems. A scenario for this would be: An existing application is upgraded to new version of Java which requires a series of code changes. Those code changes would be on a trunk/master branch while we would still be building the release branches. It would be useful in this case to set a different JDK for each branch. In this case, we could clone the plan and maintain 2 separate copies of it but this is cumbersome when all we really need is to override the JDK and command line for the branch. Essentially what we are looking for is the ability to override things on the Task page for a given branch.

            Hi daniel.camero,

            Do you mean that some of your branches are tested on different systems? If that's the case would you be able to create different build plans for different systems and pick the branches that should be tested there?

            Looking forward to reading you,

            Sten
            Bamboo Product Manager

            Sten Pittet (Inactive) added a comment - Hi daniel.camero , Do you mean that some of your branches are tested on different systems? If that's the case would you be able to create different build plans for different systems and pick the branches that should be tested there? Looking forward to reading you, Sten Bamboo Product Manager

              Unassigned Unassigned
              81f79ccfc27f Daniel Camero
              Votes:
              17 Vote for this issue
              Watchers:
              16 Start watching this issue

                Created:
                Updated:
                Resolved: