Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-25768

Allow custom Maven compiler levels for Java Specs

    XMLWordPrintable

Details

    • 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.

    Description

      Summary

      Allow customers to configure the Maven compiler source and target Java versions directly in the "Repository Stored Specs security settings" menu under "Security" for greater flexibility and compatibility with Java versions beyond 1.8, specifically for those using Java 11 or 17 from Bamboo version 9.4 onwards.

      Background

      Currently, the Bamboo Specs libraries are configured to use Java 1.8 for the maven.compiler.source and maven.compiler.target levels. While this setup does not present issues for most users, those attempting to utilise Java Specs code at Java 11 or 17 with Bamboo 9.4 or later may encounter compatibility issues, notably the inability to use text blocks due to the compiler's source level restriction.

      Problem Statement

      Customers using advanced Java features that are not supported in Java 8 (such as text blocks which require -source 15 or higher) face compilation errors. An example error encountered is:

      [ERROR] /data/data/bamboo/local-working-dir/serverSide/REPOSITORY_STORED_SPECS/repository-50528259-uat/checkout/bamboo-specs/src/main/java/plugins/Exported.java:[124,49] text blocks are not supported in -source 8 (use -source 15 or higher to enable text blocks)
      

      While workarounds exist, such as modifying the project's pom.xml to specify the Maven compiler source and target, or cloning and maintaining a customised version of the Bamboo Specs runner codebase, these solutions are not ideal. They either require disabling POM sanitisation (which could introduce security risks) or significant development overhead and departure from supported configurations.

      Proposed Solution

      Introduce an option within the "Repository Stored Specs security settings" under "Security" in Bamboo to allow users to specify their desired Java version for both the Maven compiler source and target. This feature would implement a dynamic compiler configuration approach, involving:

      • User Interface Update: Enhance the Bamboo UI to include a selection mechanism (e.g., a dropdown menu) in the "Repository Stored Specs security settings" section, enabling users to choose their preferred Java version.
      • Backend Processing Adaptation: Upon initiation of Bamboo Specs, the system will read the selected Java version setting and dynamically adjust the Maven pom.xml settings for maven.compiler.source and maven.compiler.target before compilation starts. This dynamic adjustment could be performed by injecting the specified compiler settings into the Maven command line or by modifying the pom.xml file in memory prior to execution.
      • Validation and Sanitisation Enhancements: Implement checks to validate that the selected Java version is compatible with the specified Bamboo Specs library versions and other project dependencies. This step may also entail refining the POM sanitisation process to accommodate the dynamic nature of these compiler settings.

      This approach will:

      1. Provide greater flexibility for teams using more recent Java versions.
      2. Reduce the necessity for workarounds that may compromise security or require extensive customisation.
      3. Ensure compatibility with modern Java development practices, keeping Bamboo relevant and efficient as a CI/CD tool.

      Use Cases

      A team using Java 17 features in their Bamboo Specs code would select Java 17 from the new settings option, allowing them to compile and run their specs without modification or workarounds.

      Organisations with strict security requirements can maintain compliance without disabling POM sanitisation.

      Workarounds

      Until this feature is implemented, customers can:

      1. Modify their project's Specs code pom.xml file and apply Maven source and target configuration as outlined in Maven's documentation. This may require disabling POM sanitisation on the Bamboo server with the system property -Dbamboo.repository.stored.specs.pom.sanitisation.enabled=false.
      2. Clone, modify and maintain their own version of the Bamboo Specs runner codebase to enforce custom Maven configurations. Additionally, modify the Bamboo Server to process Bamboo Specs in Docker, using a modified Docker image with custom settings.

      Additional Information

      Refer to Bamboo Specs troubleshooting for more details on current workarounds and configuration tips.

      Conclusion

      Implementing this feature would significantly enhance Bamboo's flexibility and usability for teams working with modern Java versions, reducing the need for complex workarounds and ensuring that Bamboo remains a viable CI/CD tool for Java development now and in the future.

      Attachments

        Activity

          People

            Unassigned Unassigned
            73868399605e Eduardo Alvarenga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: