Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5396

Add maven enforcer rule to ensure that JAVA_HOME is set

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.0.25
    • 2.0.26
    • None
    • None

    Description

      I recently stubbed my toe on this one again. At least in the 2.x branch, the module fontbox requires that the JAVA_HOME variable be set. If it isn't set, the project build fails in fontbox without any meaningful indication as to why, even with the -X option set in maven.

      (default-compile) on project fontbox: Compilation failure -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
      execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile
      (default-compile) on project fontbox: Compilation failure
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute
      

      Also, on our website, there's no mention that JAVA_HOME should be set. And, yes, I realize that it is set on most developers' systems.

      One solution would be to add this rule to the maven-enforcer-plugin configuration in the parent pom:

      <requireEnvironmentVariable>
        <variableName>JAVA_HOME</variableName>
        <message>The JAVA_HOME environment variable must be set!</message>
      </requireEnvironmentVariable>
      

      If this is ok, I'll add this rule in 2.x and see if I get the same behavior in trunk.

      Side note: This was probably the cause of: https://www.mail-archive.com/users@pdfbox.apache.org/msg11423.html and a few other issues.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tallison Tim Allison
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: