Can't build C/C++ projects using maven-nar plugin - maven

I'm trying to setup a simple project with an empty function (.c and .h file) on windows 7, using maven, cygwin and gcc. Following are details about my environment:
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 22:51:28+0900)
Maven home: C:\Program Files\apache-maven-3.0.5
Java version: 1.6.0_37, vendor: Sun Microsystems Inc.
Java home: C:\Progra~1\Java\jdk1.6.0_37\jre
Default locale: ko_KR, platform encoding: MS949
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
gcc (GCC) 4.5.3
When I try to build using the maven-nar plugin, I get the following error:
$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test-maven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # test-maven ---
[INFO]
[INFO] --- maven-nar-plugin:2.1-SNAPSHOT:nar-validate (default-nar-validate) # test-maven ---
[INFO] Using AOL: x86-Windows-msvc
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.600s
[INFO] Finished at: Thu May 30 18:03:18 KST 2013
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-nar-plugin:2.1-SNAPSHOT:nar-validate (default-nar-validate) on project test-maven: Cannot deduce version number from: -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I have google'd and it seems to be related to maven not finding the gcc compiler.
Cannot deduce version number from: -> [Help 1]
The output from the mvn command also suggests that maven is trying to build my project with msvc which is not available on my machine.
[INFO] Using AOL: x86-Windows-msvc
I have the gcc compiler in my path etc and I have tried to follow some of the steps suggested in this very old thread.
Does anyone know how to overcome this problem? If I'm in the wrong forum, could someone please point me to the right one?

Yes, that error is caused by a command line tool being unavailable on the path. However, in this case, since your AOL is x86-Windows-msvc, the relevant command line tool is link, not gcc. (You can see this in the source code.)
Of course, you aren't trying to use the MSVC compiler at all, so you shouldn't need link in your path anyway. To use gcc instead, you need to configure that in your POM in the maven-nar-plugin configuration. Here is a sample configuration (from this project, which you will of course need to tweak to your needs):
<configuration>
<c>
<name>gcc</name>
<includes>
<include>**/*.c</include>
</includes>
<options>
<option>-I${JAVA_HOME}/include</option>
<option>${java.os.include}</option>
<option>${stack.protector.option}</option>
<option>${architecture.option}</option>
<option>${subsystem.option}</option>
<option>${debug.option}</option>
</options>
</c>
<linker>
<name>gcc</name>
<options>
<option>${architecture.option}</option>
<option>${subsystem.option}</option>
</options>
<sysLibs>
<sysLib>
<name>${libdl.name}</name>
</sysLib>
</sysLibs>
</linker>
<libraries>
<library>
<type>executable</type>
<!-- <run>true</run> -->
<subSystem>gui</subSystem>
</library>
</libraries>
</configuration>

Related

spring boot maven plugin build-image is not working

I created demo project from start.spring.io with spring boot version 3.0.1 and java version 17.
I tried to execute below command on terminal to build Docker image
mvn spring-boot:build-image -Dspring-boot.build-image.imageName=testtesttest
It resulted in error
[INFO] [creator] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[INFO] [creator] $JAVA_TOOL_OPTIONS the JVM launch flags
[INFO] [creator] Using Java version 18 extracted from MANIFEST.MF
[INFO] [creator] No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
[INFO] [creator] : Contributing to layer
[INFO] [creator] Warning: Dependency has no SHA256. Skipping cache.
[INFO] [creator] Downloading from
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to get dependency
[INFO] [creator] unable to download
[INFO] [creator] unable to request
[INFO] [creator] Get "": unsupported protocol scheme ""
[INFO] [creator] ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.756 s
[INFO] Finished at: 2023-01-02T15:18:19+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-image (default-cli) on project demo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-image failed: Builder lifecycle 'creator' failed with status code 51 -> [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] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
I am using openjdk (version "18.0.2" 2022-07-19) on mac. Not able to figure it out. Can you please help.
Looks like the default image builder doesn't yet support Mac M1 processor. I had to add an alternative builder for maven plugin in my pom.xml as shown below:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>dashaun/builder:tiny</builder>
</image>
</configuration>
</plugin>

Build Failure: Version increase required: Failed to execute goal org.apache.felix:maven-bundle-plugin:3.0.1:baseline

Below is the error i am getting when i am adding any new method to existing code (especially when i am adding any method to interface or class)
--- animal-sniffer-maven-plugin:1.15:check (default) # deepser ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java18:1.0
[INFO]
[INFO] --- maven-bundle-plugin:3.0.1:bundle (default-bundle) # deepser ---
[INFO]
[INFO] --- maven-bundle-plugin:3.0.1:baseline (baseline) # deepser ---
[INFO] Baseline Report - Generated by Apache Felix Maven Bundle Plugin on 2018-07-09T20:24Z based on Bnd - see http://www.aqute.biz/Bnd/Bnd
[INFO] Comparing bundle deepser version 18.6.5-SNAPSHOT to version 18.6.4
[INFO]
[INFO] PACKAGE_NAME DELTA CUR_VER BASE_VER REC_VER WARNINGS
[INFO] = ================================================== ========== ========== ========== ========== ==========
[INFO] * com.myowncompany.analytica.deepser.config major 18.6.5 18.6.4 19.0.0 Version increase required
[INFO] > interface com.myowncompany.analytica.deepser.config.DeepSearchConfig
[INFO] + method getDeepSearchLibsCDNUrl()
[INFO] + access abstract
[INFO] + return java.lang.String
[INFO] - version 18.6.4
[INFO] + version 18.6.5
[INFO] -----------------------------------------------------------------------------------------------------------
[INFO] * com.myowncompany.analytica.deepser.config.impl minor 18.6.5 18.6.4 18.7.0 Version increase required
[INFO] < class com.myowncompany.analytica.deepser.config.impl.DeepSearchConfigImpl
[INFO] + method getDeepSearchLibsCDNUrl()
[INFO] + return java.lang.String
[INFO] - version 18.6.4
[INFO] + version 18.6.5
[INFO] -----------------------------------------------------------------------------------------------------------
[ERROR] com.myowncompany.analytica.deepser.config: Version increase required; detected 18.6.5, suggested 19.0.0
[ERROR] com.myowncompany.analytica.deepser.config.impl: Version increase required; detected 18.6.5, suggested 18.7.0
[INFO] Baseline analysis complete, 2 error(s), 0 warning(s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.179 s
[INFO] Finished at: 2018-07-09T20:24:41+05:30
[INFO] Final Memory: 41M/1038M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:3.0.1:baseline (baseline) on project deepser: Baseline failed, see generated report -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=1024m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
My pom.xml contains below plugin:
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>${scr.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${mvn.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Category>search</Bundle-Category>
<!-- Export only the packages that should be visible to other bundles
and JSPs -->
<Export-Package>
com.myowncompany.analytica.*
</Export-Package>
</instructions>
</configuration>
</plugin>
Any idea....i googled it out, and spend 3 hours, still not able to find root cause. Earlier this was working fine. But recently it start giving issue version need to be updated.
The baseline plugin checks if exported packages changed according to semantic versioning rules. It compares the signature of classes in the new packages against the latest release by default.
The results tell you that a minor version increase is needed for the impl package and a major version increase for the .config package.
In case you did not intend to run the baseline goal you can skip it using the maven property: baseline.skip=true
Btw. you should only run the baseline checks on API packages. On impl they do not make much sense .. but you should try to not export impl packages anyway.
On Basis of AEM 6.5
I tried the -Dbaseline.skip=true option as indicated by others but still failed.
This article here: https://felix.apache.org/components/bundle-plugin/baseline-mojo.html
Talks about adding 'skip' property.
I then added this property under my core module as indicated below and all worked fine:
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
<configuration>
<failOnMissing>false</failOnMissing>
<skip>true</skip>
</configuration>
</plugin>
I ran the command :
mvn clean -Dbaseline.skip=true install,
it worked like a charm

GitLab Runner No Compiler

need some help to help to solve this issue.
Iam running my gitlab ci, to test my maven project, everthing ist working fine but when its starting to compiling/building/installing following error recieves:
Running with gitlab-runner 10.5.0 (80b03db9)
on RolfsRunner 7d39f8f7
Using Shell executor...
Running on ISC-PRAKTIKANT...
Fetching changes...
Removing target/
HEAD is now at a7189518 7.2
Checking out a7189518 as rolf...
Skipping Git submodules setup
Checking cache for default...
Successfully extracted cache
$ cd C:\Program Files\GitLab-Runner\builds\7d39f8f7\0\dev\imsPlatform & mvn compile
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for de.immersight:imsPlatform:war:1.0
[WARNING] 'dependencies.dependency.systemPath' for immersight:imsLibrary:jar should use a variable instead of a hard-coded path C:\Users\Rolf\Desktop\imsLibrary-1.0.jar # line 59, column 19
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ---------------------< de.immersight:imsPlatform >----------------------
[INFO] Building imsPlatform 1.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # imsPlatform ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Program Files\GitLab-Runner\builds\7d39f8f7\0\dev\imsPlatform\de\immersight\stats\database\versions
[INFO] Copying 1 resource
[INFO] Copying 154 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # imsPlatform ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 172 source files to C:\Program Files\GitLab-Runner\builds\7d39f8f7\0\dev\imsPlatform\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.769 s
[INFO] Finished at: 2018-03-13T13:05:58+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project imsPlatform: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[ERROR] -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Running after script...
$ echo CI_ENVIRONMENT_NAME
CI_ENVIRONMENT_NAME
ERROR: Job failed: exit status 1
My eclipse and windows cmd compiling fine without problems everthing is installed and all environment variables are set:
C:\Users\Rolf>mvn -version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: C:\Users\Rolf\Maven-3.5.3\bin\..
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_161\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
C:\Users\Rolf>javac -version
javac 1.8.0_161
I had the same problem. After installing a JDK and editing the environment variables I had to restart my gitlab-runner with administrator privileges.
gitlab-runner.exe restart
May not interesting for you anymore ;)

Building SonarQube with maven and batch_boostrap/index cannot be found

I'm running mvn sonar:sonar in the directory of the project I'm running. I already have my pom.xml updated:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7.1</version>
</plugin>
After running sudo mvn sonar:sonar (I am on ubuntu 14.04) in my terminal, I get the following error:
eschwartz#LATITUDE:~/ideaprojects/xQueryEngine$ sudo mvn sonar:sonar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xQueryEngine (Solr 4 REX) 1.11.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:2.7.1:sonar (default-cli) # xqe ---
[INFO] User cache: /root/.sonar/cache
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.854s
[INFO] Finished at: Wed Feb 17 15:56:59 EST 2016
[INFO] Final Memory: 17M/302M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project xqe: Fail to download libraries from server: Status returned by url : 'http://localhost:9000/batch_bootstrap/index' is invalid : 404 -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Anyone know how to fix this?
Thanks.
You have to set sonar.host.url=http://localhost:9000/sonar. You can do this by passing -Dsonar.host.url=... to mvn, or ideally set it in your Maven Global/Project Settings so that you don't always have to pass it as a command line argument.
Details: if your dashboard is at localhost:9000/sonar then it means you're using sonar.web.context=/sonar , which is different from the default (/). So you need to tell the scanner where to find SonarQube.

Building Hadoop with Maven Error

When I try to build hadoop using:
mvn install -e -DskipTests
It always throw the following error:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/xiu/myGit/hadoop2/hadoop-mr1-project/hadoop-mr1/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java:[153,4] getDelegationTokenSecretManager() is not public in org.apache.hadoop.hdfs.server.namenode.FSNamesystem; cannot be accessed from outside package
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Hadoop MR1 ................................. FAILURE [3.144s]
[INFO] Apache Hadoop MR1 Examples ........................ SKIPPED
[INFO] Apache Hadoop MR1 Project ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.353s
[INFO] Finished at: Thu Jul 18 11:01:30 PDT 2013
[INFO] Final Memory: 32M/100M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project hadoop-mr1: Compilation failure
[ERROR] /home/xiu/myGit/hadoop2/hadoop-mr1-project/hadoop-mr1/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java:[153,4] getDelegationTokenSecretManager() is not public in org.apache.hadoop.hdfs.server.namenode.FSNamesystem; cannot be accessed from outside package
[ERROR] -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I have tried clean and reinstall different versions of maven with no luck. Any expert knows what is going on here?
I came across same problem during hadoop 2.2.0 source code building. During "mvn install -DskipTests" this error came in "Hadoop Auth" Folder.
From somewhere(i dont remember from where) i came to know that there is one missing dependency in pom.xml of this Hadoop Auth folder
dependency is
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
I added this dependency and again tried "mvn install -DskipTests". My error resolved.
You just try to add this dependency in pom.xml of "APACHE Hadoop MR1". May ur error will resolve
Seems like Maven compiler plugin complaining that getDelegationTokenSecretManager() method in Hadoop FSNameSystem is not accessible due to method visibility i.e. it's not public:
[ERROR] /home/xiu/myGit/hadoop2/hadoop-mr1-project/hadoop-mr1/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java:[153,4] getDelegationTokenSecretManager() is not public in org.apache.hadoop.hdfs.server.namenode.FSNamesystem; cannot be accessed from outside package
[INFO] 1 error
I would suggest you to check on your Hadoop version defined in your pom.xml, and double check that the method is really accessible in the Hadoop version JavaDoc.

Resources