How to set up apache ranger on apple macbook pro m1 - maven

I'm trying to set up apache ranger for work using this https://github.com/apache/ranger/tree/master/dev-support/ranger-docker
however by running
mvn clean package -DskipTests
I'm getting the following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:exploded (prepare) on project security-admin-web: Execution prepare of goal org.apache.maven.plugins:maven-war-plugin:2.6:exploded failed: Unable to load the mojo 'exploded' in the plugin 'org.apache.maven.plugins:maven-war-plugin:2.6' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null The entire error can be seen in this picture:
[1]
and as an alternative provided in the github, when I run:
docker-compose -f docker-compose.ranger-base.yml -f docker-compose.ranger-build.yml up
I get the error:
ranger-build | The JAVA_HOME environment variable is not defined correctly
ranger-build | This environment variable is needed to run this program
ranger-build | NB: JAVA_HOME should point to a JDK not a JRE
ranger-build | mv: cannot stat 'target/ranger-*': No such file or directory
ranger-build exited with code 1
I have also tried following https://medium.com/swlh/hands-on-apache-ranger-docker-poc-with-hadoop-hdfs-hive-presto-814344a03a17
however it gets stuck in the ranger-admin container and localhost:6080 doesn't work.
[1]: https://i.stack.imgur.com/57ubI.jpg

I was able to solve this by downgrading my maven to 3.6.3 as I was having incompatibility issues, although this particular issue was resolved by adding maven war 2.6 plug in in pom.xml but then more incompatibility issues arose so i had to uninstall and reinstall a completely different maven version and that fixed all the issues.

Related

Cannot invoke "java.io.File.isFile()" because "this.inputFile" is null

I met a problem when trying to build Quickfixj Project on Windows 10.
I tried the command using Git:
$ mvn clean package -Dmaven.javadoc.skip=true -DskipTests -PskipBundlePlugin
and it returned error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.4.2:single (bin-assembly) on project quickfixj-distribution: Execution bin-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:3.4.2:single failed: Cannot invoke "java.io.File.isFile()" because "this.inputFile" is null -
I've never met such problem and I searched online but no relevant solutions were found.
Shall I reinstall maven or other solutions recommended? Thanks!
This seems to be a bug with the QuickFIX/J build process.
If you omit -PskipBundlePlugin the build will succeed.
I had the same problem for me with mac m1, on vscode;
I just changed the version in the pom.xml file to:
maven-assembly-plugin-version>3.1.0</maven-assembly-plugin-version
and it worked for me.
in addition to that I Installed some apache extension for vscode.

Build the project using gradle

I have so far used maven to build the java code.
I was trying to build this project which is using gradle: https://github.com/opendistro-for-elasticsearch/anomaly-detection
I followed the below steps and it is failing continuously in build.
After cloning the code,
Step 1: As per the steps mentioned in the link, I installed java first and set the Java home and path like below
yum install java-1.8.0-openjdk
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
Step 2 : I tried to build the project using gradlew like below and end up with the error,
anomaly-detection]# ./gradlew
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
FAILURE: Build failed with an exception.
* Where:
Build file '/host/eclipse_back/opendistro/anomaly-detection/build.gradle' line: 55
* What went wrong:
A problem occurred evaluating root project 'opendistro-anomaly-detection'.
> Failed to apply plugin [id 'elasticsearch.esplugin']
> Could not create plugin of type 'PluginBuildPlugin'.
> Could not generate a decorated class for type PluginBuildPlugin.
> org/elasticsearch/gradle/plugin/PluginPropertiesExtension has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
Why it's failing? Any help is appreciated!
Thanks,
Harry
You need to setup your build environment for gradle to use a more recent java version. You can set the java version with the gradle property org.gradle.java.home:
org.gradle.java.home=<path to JDK home>
I think the problem is that you use Java 8 and in the README they want to use Java 14.
To build from command line set JAVA_HOME to point to a JDK 14 before running ./gradlew
Then it should be possible to build and test the project with the following command:
./gradlew build
EDIT:
Can you check your configuration of your IDE. Did the Gradle JVM use the correct Java version? If you are using Intellik you can check it following this post:

Maven release branch fails with error=7, Argument list too long

We have recently migrated our multimodule(each module with a pom.xml) repository from SVN to GIT.SCM connection in all pom.xml files updated from svn to git.
When i am trying to create a branch from git repository using maven release plugin it fails with the below error
"Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:branch (default-cli) on project intgr: An error is occurred in the checkin process: Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "/bin/sh" (in directory "/u01/remote-agent-home/xml-data/build-dir/IN-CDBFG-JOB1/mahirepository"): error=7, Argument list too long -> [Help 1]"
On examining logs i understand below command generated this error.
"[INFO] Checking in modified POMs... [INFO] Executing: /bin/sh -c cd /u01/remote-agent-home/xml-data/build-dir/IN-CDBFG-JOB1/mahirepository && git add -- intgr-parent/pom.xml archetypes/pom.xml and 1000 more pom files "
Is there a way i can workaround or fix this issue?
Maven version : Apache Maven 3.0.4
JDK version : 1.7.0_01
Maven command :
mvn -s ./settingsBamboo.xml --batch-mode release:branch -DbranchName=${bamboo.branchname} -DupdateWorkingCopyVersions=true -DsuppressCommitBeforeBranch=true -DautoVersionSubmodules=true -DremoteTagging=false -DupdateBranchVersions=false -X
I am currently facing this problem as well, but I got a bit further on this.
The issue has nothing to do with Java or Maven, it's a Linux limitation.
using getconfig MAX_ARGS you can find the max amount of bytes you can use as arguments.
Large maven commands can easily go beyond this, and the amount of bytes differs largely per distro.
Check the amount of bytes you can use, and try to get your command below that.
You could for example move into the build dir first, and then run the command relative.
Another solution would be to increase the amount of usable space, but I have so far not gotten that working.
If anyone does or you have fixed this yourself, let me know.

Sonarqube invalid value for java binaries

I'm trying to upload my project to a remote sonarqube server.
This is the command I run sonar scanner:
sonar-scanner -Dsonar.projectKey=my-project -Dsonar.host.url=https://xxxx:9000 -Dsonar.login=the-secret-key -Dsonar.java.binaries=**/target/classes
but it throws the error on java.binaries.
INFO: Configured Java source version (sonar.java.source):
none
INFO: JavaClasspath initialization
ERROR: Invalid value for sonar.java.binaries
INFO: ------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------
INFO: Total time: 20.276s
INFO: Final Memory: 10M/161M
INFO: ------------------------------------------------------
------------------
ERROR: Error during SonarQube Scanner execution
No files nor directories matching **/target/classes
I tried different values like ./target, /target/, /target/classes (where the jar is being stored). However, I am encountering this error of not found. (even though the directory exists)
By running sonar:sonar on my IDE and maven sonar:sonar on my terminal would send over the result to sonarqube, but my goal is to include this command in my jet-steps
Very old post but may help someone. I had similar issue and below configuration worked for me:
sonar.sources=src/main/java
sonar.java.binaries=target/classes
We also experienced a similar issue on our project (Maven multimodule), and for us the following configuration made things work:
sonar.java.binaries=.
sonar.java.source=8
sonar.sources=.
PS Java source is just for reference, it should not matter to fix the issue.
In my case, Im working with gradle, and we have subaplications, we are using sonarqube plugin from azure. I have to adapt to find binaries like this way:
sonar.java.binaries=./streamHubAndroidSDK/build/**,./nota/build/**,./app/build/**
But later I found that its better to define like this:
sonar.java.binaries=**/build/**
I can find this first building Android-Gradle project locally, and looking for all .class generated with bash:
find . -path '*/build/*.class' | xargs | tr ' ' ','

Jenkins ERROR: Failed to parse POMs java.io.IOException: Cannot run program error=2, No such file or directory

In jenkins I am forcing the execution to happen in one of the slaves.
in jenkins configuration I have updated the JAVA_HOME and MAVEN location to the location where its installed in the slave. When I start the build in jenkins I receive the following error
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/home/jmeter/jdk1.8.0_112/bin/java" (in directory "/home/jmeter/apache-jmeter-2.13/bin/workspace/MyProject"): error=2, No such file or directory
PS : /home/jmeter/apache-jmeter-2.13/bin/workspace/MyProject - This directory got created and does exist in the slave machine
Can someone please share their expertise in resolving it ?
I needed to add Tool location of JDK8 for machine i run test on.
looks like there is a problem in the MVN installation. PLS make sure in the global config that you have the required mvn installation.
jenkins-->manage-->configure look for Maven installations and use automatic installation for the required version
make sure you have the JDK installation in the same config file
After wasting one day trying with different things going through different suggestions I got nothing. But, it was actually very simple. Please add the JDK path as bellow to your JDK Path in Jenkins-
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
You should assign the JDK in the Meta Data,The JAVA_HOME of system is not work for build.
Check your Maven version selected into the Manage Jenkins->Global Configurations->Maven->Maven Installations->Install from Apache->Version is same as installed on the server and your maven project.
You might have left out a few dependencies resulting in this issue.
Go back and download java and set the path as before:
To download, use
$yum -y install java-1.8*
Set the path to
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.amzn2.0.1.x86_64
Note: Get your path using command
find /usr/lib/jvm/java-1.8* | head -n 3
This got resolved after adding maven_home and providing the path in the global properties.
Go to: Jenkins ⟶ Manage Jenkins ⟶ Global Properties ⟶ MAVEN_HOME [C:\Program Files\Apache\apache-maven-3.6.3-bin\apache-maven-3.6.3]
Just in case someone else runs into this. I was getting this error because someone setup the JDK in Global Tool Configuration to download a windows version of the JDK, but my instance of jenkins is running on linux. Once I made the change to use a linux version of the JDK my issue was resolved.

Resources