Unable to build searchguard jar with java 8 and maven 3.3

Hi,

I am using searchguard-7.0.1-35.0.0 with ELK 7.0.1.
I am trying to locally build searchguard jar (community-version) by using the github project GitHub - floragunncom/search-guard: Search Guard Plugin - Security for Elasticsearch.

Maven version: Apache Maven 3.3.9
Java version: 1.8.0_141, vendor: Oracle Corporation

I am building the project using the command -
mvn -s settings.xml -B clean package

My maven build is failing with the following error message
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
Maven 3.5.4 or later required
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.563 s
[INFO] Finished at: 2019-06-14T06:59:25+00:00
[INFO] Final Memory: 21M/821M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (enforce-maven) on project search-guard-7: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation

After upgrading Maven, it further failed due to java version as it requires Java 11. I was able to build only after upgrading to java 11.
Is it mandatory to build searchguard-7 project with java 11 and maven>=3.5.4?

I am unable to find the mvn-enforcer in searchguard’s pom.xml. Is there a dependent project that is enforcing this version check? Can I disable this version-check so that I can build with my existing java, mvn versions?

Any help would be much appreciated.

Thanks,
Shivani

You need Java 11 and Maven >= 3.5.4 to build SG 7, see https://repo1.maven.org/maven2/com/floragunn/search-guard-parent/7.35.1/search-guard-parent-7.35.1.pom

But, why has this version enforcement been added in search-guard-parent pom? Does this also imply that searchguard7 elasticsearch plugin does not work on java 8??
Does SG7 work with java 11 alone?

We usually follow the way that Elastic is building. Compilation is done with Java 11 and a Java 8 target. So Search Guard is compatible and tested with Java 8 and Java 11.

@jkressin Thanks for the response. But, my concern is, when Searchguard is compatible and compiled with Java 8 and 11 as you said, then, why has the version-enforcer been added in searchguard-parent pom to allow only java 11 while building the jar?

Because this is the way that Elastic is building their software as well. Use Java 11 for compilation with a Java 8 target.

<maven.compiler.target>1.8</maven.compiler.target>

You can of course use another parent pom and then use Java 8 exclusively if this is what you want to do.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.