Maven error when attempting to build a zookeeper rpm package - maven

Trying to build an zookeeper rpm package.
In .spec file have specified:
BuildRequires: python-devel,gcc,make,libtool,autoconf,cppunit-devel,hostname,systemd,maven
But does not seem to like the version of maven used:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (banned-commons-lang) on project parent: A type incompatibility occured while executing org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce: org.sonatype.aether.util.DefaultRepositorySystemSession cannot be cast to org.eclipse.aether.RepositorySystemSession
Is there a way I can force it to use a newer maven like https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
That I have been advised works ok with zookeeper 3.8.0?
Have tried specifying BuildRequires >=3.8.6
But results in this error:
Error: No Package found for maven >= 3.8.6
Any help appreciated - very new to builds.

Thanks khmarbaise, pointed me in the right direction, in the .spec file I added the following to use the latest maven:
Added new source entry for maven repo in package info section:
Source5: https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
%prep
tar xvf %SOURCE5 -C /usr/local/**
%build
/usr/local/apache-maven-3.8.6/bin/mvn -DskipTests package
Now .rpm files generated as expected.

Related

Could not find artifact org.apache.pulsar:pulsar-broker:pom:2.12.0-SNAPSHOT in apache.snapshots (https://repository.apache.org/snapshots)

While following the instructions to setup IntelliJ for pulsar development I got the below error
Could not find artifact org.apache.pulsar:pulsar-broker:pom:2.12.0-SNAPSHOT in apache.snapshots (https://repository.apache.org/snapshots)
Digging deeper into the snapshots, I don't see pulsar-broker at 2.12.0 either: https://repository.apache.org/content/groups/snapshots/org/apache/pulsar/pulsar-broker/
Is there some configuration step missing?
Attempted Fix [RESOLVED]
accepted answers steps and fix an issue with SDKMAN to have mvn call Java 17
I tried the command mvn -Pcore-modules,-main clean install -DskipTests -Dspotbugs.skip=true and got the new error below.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project buildtools: Compilation failure
[ERROR] /Users/brandon.hoffman/Projects/pulsar/buildtools/src/main/java/org/apache/pulsar/tests/RetryAnalyzer.java:[30,18] cannot access org.testng.ITestResult
[ERROR] bad class file: /Users/brandon.hoffman/.m2/repository/org/testng/testng/7.7.0/testng-7.7.0.jar(org/testng/ITestResult.class)
[ERROR] class file has wrong version 55.0, should be 52.0
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.
Running this on the command line will fix that problem:
mvn -Pcore-modules,-main clean install -DskipTests -Dspotbugs.skip=true
You must use Java 17 for compiling the master branch version of Pulsar (requirements).
It's possible that there has been some change in the maven build after the instructions were originally written.
It does not look like the project is currently using the repository.apache.org for nightly snapshots. You should ask your question on the dev#pulsar.apache.org mailing list.
Also we have not yet cut the 2.12 branch. The VOTE for the first release of 2.11.0 just passed the PMC.
(FYI I am an Apache Pulsar PMC Member)

AEM 6.5 WKND repo build issues

I created a maven project in batch mode by typing the following command:
mvn archetype:generate -B -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=22 -DgroupId=com.adobe.aem.guides -Dversion=0.0.1-SNAPSHOT -DappsFolderName=wknd -DartifactId=aem-guides-wknd -Dpackage=com.adobe.aem.guides.wknd -DartifactName="WKND Sites Project" -DcomponentGroupName=WKND -DconfFolderName=wknd -DcontentFolderName=wknd -DcssId=wknd -DisSingleCountryWebsite=n -Dlanguage_country=en_us -DoptionAemVersion=6.5.0 -DoptionDispatcherConfig=none -DoptionIncludeErrorHandler=n -DoptionIncludeExaples=y -DoptionIncludeFrontendModule=y -DpackageGroup=wknd -DsiteName="WKND Site"
when I type mvn -PautoInstallSinglePackage clean install
I get the following error:
[ERROR] Failed to execute goal on project aem-guides-wknd.ui.apps: Could not resolve dependencies for project com.adobe.aem.guides:aem-guides-wknd.ui.apps:content-package:0.0.1-SNAPSHOT: Could not find artifact com.adobe.aem.guides:aem-guides-wknd.ui.frontend:zip:0.0.1-SNAPSHOT
From the error I guess and when I searched that there is no such artifactid in maven repository. Can someone please help me out here?
If your sole requirement is to build the wknd project, then just download the maven project from git and import it as a maven project in eclipse. After that build it. That should hopefully resolve your issue.
You have below options :
1.You Can check your root pom.xml file. There you can comment out ui.frontend module i.e. <!--module> ui.frontend </module-->. After hat you can run your package build command.
2. you can got to each sub-module like core,ui.appss and run following command to build individually mvn clean install -PautoInstallBundle
Let me know if this helps or will look into some other solution.
Inside parent pom.xml comment dispatcher module
example :
<modules>
<module>all</module>
<module>core</module>
<module>ui.frontend</module>
<module>ui.apps</module>
<module>ui.apps.structure</module>
<module>ui.config</module>
<module>ui.content</module>
<module>ui.content.sample</module>
<module>it.tests</module>
**<!--<module>dispatcher</module>-->**
<module>ui.tests</module>
</modules>

Is there an Docker Maven Plugin in jar file?

Just a quick inquiry to see if there are any .jar files for docker - maven plugin that can be directly installed in Apache Maven using the mvn install command.
I was trying to run a docker-maven plugin using a pom file on windows but was getting the following error:
[ERROR] Failed to parse plugin descriptor for
org.codehaus.plexus:plexus-compone nt-metadata:1.6
(C:\Users\user2.m2\repository\org\codehaus\plexus\plexus-com
ponent-metadata\1.6\plexus-component-metadata-1.6.jar): error in
opening zip file -> [Help 1]
I have installed plexus-component-metadata-1.6.jar and plexus-component-metadata-1.6.pom but it is not working..
Any help please..??
This error can occur when your connection gets interrupted during your dependencies are being downloaded last time.
Delete the relevant repository folder and run mvn clean install command again to download a fresh copy of corrupted file.

mvn sonar:sonar throws exception while doing Java AST scan

Please note :- My mvn clean install goes successful
but when i do mvn sonar:sonar it throws me
[ERROR] Squid Error occurs when analysing :/junk/test/src/main/java/API/com/API/HelloAPI.java
org.sonar.squid.api.AnalysisException: The source directory does not correspond to the package declaration com.API
at org.sonar.java.ast.visitor.PackageVisitor.checkPhysicalDirectory(PackageVisitor.java:93) [sonar-squid-java-plugin-2.8.jar:na]
at org.sonar.java.ast.visitor.PackageVisitor.createSourcePackage(PackageVisitor.java:75) [sonar-squid-java-plugin-2.8.jar:na]
http://sonar-dev.787459.n3.nabble.com/file/n3324837/squid-test.zip
The message is quite clear: the package declaration is wrong. It should be API.com.API if the source directory is /junk/test/src/main/java (that is the default value in Maven). An alternative is to change the source dir to src/main/java/API.
Could it be that your POM contains this line:
<sourceDirectory>.</sourceDirectory>
If so, changing it to this might help:
<sourceDirectory>src/main/java</sourceDirectory>
Maven doesn't care, but sonar does.
I had the same problem with sonar and a maven project generated by eclipse.
(Found the solution at http://www.digipedia.pl/usenet/thread/13899/13064/ )
I got the same error message after upgrading to a more recent sonar plugin (sonar-maven3-plugin:3.7.1/3.7.3/4.0 running against SonarQube Server 3.5.1) for a source file which worked with 3.6-RC3/3.6.3/3.7.0. Apparently 3.7.1 introduced the issue :-/

maven-bundle-plugin: The defined artifact is not an archetype

I configured the "maven-bundle-plugin" from Apache Felix as a Maven Archetype in Eclipse (since it was missing), but when I try to create a new Maven project with it, I get as error:
Unable to create project from archetype [org.apache.felix:
maven-bundle-plugin:2.3.5 -> ]
The defined artifact is not an archetype
I then tried the same procedure with ops4j Pax (which is pre-configured in Eclipse), which seems to be something similar, and it worked, so I think I'm doing it right and the problem is with "maven-bundle-plugin".
What does the error message mean, and what can I do to fix it, or am I somehow getting this all wrong?
[EDIT] While I can create the project with ops4j Pax, I afterward get:
Project build error: Unknown packaging: bundle
which as apparently been fixed in 2009! So this obviously doesn't work either.
I finally had success with the following procedure:
cd workspace
mvn org.ops4j:maven-pax-plugin:create-bundle -Dpackage=demo.service
-DbundleGroupId=demo.service -DbundleName=demo.service-bundle
-Dversion=0.1
cd demo.service-bundle
mvn org.ops4j:maven-pax-plugin:eclipse
# Import project as Eclipse project
# (I haven't try to import it as maven project)
And btw, it took me about ages to work out why this doesn't work in a Windows batch file: that is because mvn is itself a batch file, and so you have to use "call".

Resources