Uploaded image for project: 'Maven Enforcer Plugin'
  1. Maven Enforcer Plugin
  2. MENFORCER-348

add a graalvm enforcer rule

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Standard Rules
    • None

    Description

      Our project relies on the GraalVM. We currently have a gmavenplus-plugin snippet that enforces 1) that the build JDK is GraalVM, and 2) that it has the required version. It looks like this:

       

      <script><![CDATA[
          import org.apache.tools.ant.BuildLogger
          import org.apache.tools.ant.types.LogLevel
      
          def currentProjectDir = new File("${basedir}")
      
          def javaVmName = System.properties['java.vm.name']
          def vmVersion = "${java.vm.version}".tokenize("-")
          def runtimeVer = "${java.runtime.version}".tokenize(".")
          def graalVersion = "${graal.version}";
      
          if (graalVersion.reverse().take(1) == "0") {
              graalVersion = graalVersion.substring(0, graalVersion.length() - 2)
          }
      
          if (!(javaVmName =~ "GraalVM") && !(runtimeVer.contains("graal"))) {
              ant.fail "Build JVM is not GraalVM."
          }
      
          if (!javaVmName.endsWith("${graal.version}") && !(vmVersion.contains(graalVersion))) {
              ant.fail "GraalVM version is not ${graal.version}. Found ${vmVersion} instead."
          }
      
          print "Build JVM: ${javaVmName}\n"
      ]]>
      </script>
      

       

      It would be great if the enforcer plugin had a builtin rule for this that looked like this:

       

      <requireGraalVmVersion> 
          <version>19.3.1</version>
      </requireGraalVmVersion>
      

      Attachments

        Activity

          People

            rfscholte Robert Scholte
            ian.springer Ian Springer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: