You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tim Allison (Jira)" <ji...@apache.org> on 2022/03/21 13:38:00 UTC

[jira] [Created] (PDFBOX-5396) Add maven enforcer rule to ensure that JAVA_HOME is set

Tim Allison created PDFBOX-5396:
-----------------------------------

             Summary: Add maven enforcer rule to ensure that JAVA_HOME is set
                 Key: PDFBOX-5396
                 URL: https://issues.apache.org/jira/browse/PDFBOX-5396
             Project: PDFBox
          Issue Type: Task
    Affects Versions: 2.0.25
            Reporter: Tim Allison


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.

{noformat}
(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
{noformat}

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. :D

One solution would be to add this rule to the maven-enforcer-plugin configuration in the parent pom:
{code:java}
  <requireEnvironmentVariable>
    <variableName>JAVA_HOME</variableName>
    <message>The JAVA_HOME environment variable must be set!</message></requireEnvironmentVariable>
{code}

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.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org