I want to make a release with the maven release plugin in two steps:
1. mvn clean release:prepare
2. mvn release:perform
It worked fine the last two releases, but after changing my IDE from intellij to eclipse I am not able to perform a release this way with apache-maven 3.5.3 and eGit 4.9.2.
The general structure of my project is:
parent-dir
-> pom.xml
-> child1-dir
-> pom.xml
-> child2-dir
-> pom.xml
child1 and child2 contain code and packaging to jar, the parent has packaging goal pom.
Configuration of maven-release-plugin in parent pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>
The plugin updates all poms with correct version #, committs changes and pushes to the remote repository for both child modules. But for the parent module I get the following error at the end of the log:
[INFO] Reactor Summary:
[INFO]
[INFO] test Parent 0.12-SNAPSHOT ........................ FAILURE [02:46 min]
[INFO] test Child1 ...................................... SUCCESS [ 0.011 s]
[INFO] test Child2 0.12-SNAPSHOT ........................ SUCCESS [ 0.205 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:48 min
[INFO] Finished at: 2018-09-08T12:56:06+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project test-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] git#github.com: Permission denied (publickey).
[ERROR] fatal: Could not read from remote repository.
[ERROR]
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.
[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 do not understand why I get this error message after succesfull commiting and pushing the children modules?
You need to add your public key in Github.
For help please refer https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
Related
I've created a multi module Maven project in Intellij. The structure is the following
parent
|-module1
|
|-module2
|
|-module3
First I tried to build the parent module, everything was fine. But then I added a class in module2 and used it in module1. So I added a dependency in module1 pom.xml
<dependency>
<groupId>org.example</groupId>
<artifactId>module2</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
But when I try to build the parent (or the module1 as well)- I get the following
[INFO] Building 2 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.example:module2:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.188 s
[INFO] Finished at: 2021-12-02T23:29:35+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project module1: Could not resolve dependencies for project org.example:module1:jar:1.0-SNAPSHOT: Could not find artifact org.example:module2:jar:1.0-SNAPSHOT -> [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.
As I understand it tries to download the dependency from the central maven repository. I don't have any repository con1figurations at all.
I am running out of ideas what else to try.
Can you help to fix it?
This is most likely the ordering of your module builds - as specified in the parent POM. Module1 requires a class from module2, and that module (module2) is not yet built. Try swapping the ordering of module1 and module2 in the parent POM so that module2 is built before module1.
Problem
We are trying to consume a Maven components in a private Maven repository... The dependency right now is not being pulled for some reason... I have declared the dependency in gradle as follows:
dependencies {
implementation group: 'super_.platform.client', name: 'client-feign', version: '1.0.0-SNAPSHOT'
}
repositories {
maven {
url "https://gitlab.com/api/v4/projects/22268428/packages/maven"
}
}
When running gradle eclipse to pull the dependency, the command fails with the following:
[INFO] Resolving super_.platform.client:client-feign:jar:1.0.0-SNAPSHOT with transitive dependencies
[WARNING] Missing POM for super_.platform.client:client-feign:jar:1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:07 min
[INFO] Finished at: 2020-11-06T19:49:27Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Missing:
[ERROR] ----------
[ERROR] 1) super_.platform.client:client-feign:jar:1.0.0-SNAPSHOT
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=super_.platform.client -DartifactId=client-feign -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) org.apache.maven.plugins:maven-downloader-plugin:jar:1.0
[ERROR] 2) super_.platform.client:client-feign:jar:1.0.0-SNAPSHOT
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] org.apache.maven.plugins:maven-downloader-plugin:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[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/MojoExecutionException
Question
Since the Git repo at Gitlab is private, I would imagine the Maven repository is also private. How to download that in Gradle?
Solution
Add the token information in the Maven repo passing the value through Environment Variable: GITLAB_TOKEN. You need to use the credentials section with an HTTP Header object.
maven {
url "https://gitlab.com/api/v4/projects/22268428/packages/maven"
credentials(HttpHeaderCredentials) {
name "Private-Token"
value System.env.GITLAB_TOKEN
}
authentication {
header(HttpHeaderAuthentication)
}
}
After that, I was able to pull the library from the private Maven repository within the Gitlab repo.
GITLAB_TOKEN=1234556 gradle eclipse
(Maven build failure for my service):Maven Install is giving me this error. and also there is no settings.xml file in .m2 folder.
[INFO] Adapter CSI_ORDERTRACK_STATUS Bundle ............... SUCCESS [ 0.581 s]
[INFO] Adapter CSI_ORDERTRACK_STATUS Bundle Dependencies .. SUCCESS [ 0.011 s]
[INFO] Adapter CSI_ORDERTRACK_STATUS Bundle Service ....... FAILURE [01:12 min]
[INFO] Adapter CSI_ORDERTRACK_STATUS SWM Zip .............. SKIPPED
[INFO] Adapter CSI_ORDERTRACK_STATUS SWM Package .......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project CSI_ORDERTRACK_STATUS-service: Could not resolve dependencies for project maf.service:CSI_ORDERTRACK_STATUS-service:jar:200.0.14: Failed to collect dependencies at maf:adapter-ordertrackdb:jar:200.0.14: Failed to read artifact descriptor for maf:adapter-ordertrackdb:jar:200.0.14: Could not transfer artifact maf:adapter-ordertrackdb:pom:200.0.14 from/to central (https://repo.maven.apache.org/maven2): connect timed out -> [Help 1]
[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/DependencyResolutionException
200.0.14 dependency Service_pom is given below:
<groupId>maf.service</groupId>
<artifactId>CSI_ORDERTRACK_STATUS-service</artifactId>
<version>200.0.14</version>
<packaging>jar</packaging>
<name>Adapter CSI_ORDERTRACK_STATUS Bundle Service</name>
<dependencies>
<dependency>
<groupId>maf</groupId>
<artifactId>adapter-ordertrackdb</artifactId>
<version>200.0.14</version>
</dependency>
<dependency>
Have you tried running Maven in offline mode?
mvn -o install
By default Maven will try to fetch external dependencies from central.
Try to build af:adapter-ordertrackdb:pom:200.0.14 first (non recursive - mvn -N install), and then try Maven install.
If you could supply the pom's it could be helpful.
i have a x-module with those properties:
module-name: x-datamodel
this is a part of the pom.xml
<groupId>com.x.datamodel</groupId>
<artifactId>x</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
i have install the project in a local repository with this command line:
mvn install:install-file -Dfile=/Users/me/Documents/Projects/x-datamodel/target/classes/x-datamodel.jar -DgroupId=com.x.datamodel -DgeneratePom=true -DlocalRepositoryPath=/Users/me/Documents/Projects/me-repository -DcreateChecksum=true -DartifactId=x -Dversion={1.0} -Dpackaging=jar
and added the project in bitbucket.
I try to integrate the module x in another project y.
here a part of the y's pom.xml
<dependency>
<groupId>com.x.datamodel</groupId>
<artifactId>x</artifactId>
<version>${x.version}</version>
</dependency>
<repositories>
<repository>
<id>me-repository</id>
<url>https://bitbucket.org/me/me-repository/src/master</url>
</repository>
</repositories>
i can import some classes of the module x in the project y, but when i build the y project i get this error:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/serviceImpl/UserServiceImpl.java:[3,32] package com.x.datamodel.model does not exist
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/serviceImpl/UserServiceImpl.java:[18,12] cannot find symbol
symbol: class User
location: class com.y.server.serviceImpl.UserServiceImpl
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/security/CustomUserDetailsService.java:[3,32] package com.x.datamodel.model does not exist
[INFO] 16 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:56 min
[INFO] Finished at: 2016-12-28T15:51:05+01:00
[INFO] Final Memory: 29M/209M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project y: Compilation failure: Compilation failure:
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/serviceImpl/UserServiceImpl.java:[3,32] package com.x.datamodel.model does not exist
[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
after installing the repository i have the library into this path:
.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar
why not:
.m2/repository/com/x-datamodel/x/1.0/x-1.0.jar
I tend to think the file is corrupted. Try deleting it and downloading it again.
Try removing the below lines
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
With :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
Because I want to use ActiveAndroid and ActiveAndroid-Validation I need to use Maven (which I never heard of until yesterday). So I installed maven and then tried to install ActiveAndroid.
I wrote a custom serializer in ActiveAndroid using JodaTime and included a JodaTime jar in the ActiveAndroid libs folder. When I build the project using ant it works perfectly well. Using Maven I first downloaded and installed JodaTime in Maven using mvn clean install from within the JodaTime source folder. Seeing the following lines this was successful:
[INFO] --- maven-install-plugin:2.4:install (default-install) # joda-time ---
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/pom.xml to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.pom
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3-javadoc.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3-javadoc.jar
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3-sources.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.603s
[INFO] Finished at: Thu Sep 26 13:00:54 CEST 2013
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
I then tried to install ActiveAndroid using the same mvn clean install from within the ActiveAndroid source folder. This however, resulted in the following errors:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.095s
[INFO] Finished at: Thu Sep 26 13:01:08 CEST 2013
[INFO] Final Memory: 13M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project activeandroid: Compilation failure: Compilation failure:
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[3,21] package org.joda.time does not exist
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[22,16] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[7,24] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[19,26] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[27,28] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :activeandroid
Does anybody know how I can solve this? All tips are welcome!
==EDIT==
The pom.xml of ActiveAndroid can be found here. I did not change anything in it.
If your IDE does not complain, it means your IDE could build the project.
Then I assume your IDE does not rely on maven to build. I would recommand a stronger integration between maven and your IE.
You are not supposed to manually add the libs to your classpath (in IDE)
Your POM miss the dependency
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
As you have the android-maven-plugin in your build, you need to supply path to the SDK. For this maven plugin, this is done by adding it as property (android.sdk.path) in the properties section of the POM.
So you'll have something like this:
<properties>
<android.sdk.path>your/path/here</android.sdk.path>
</properties>
For quick solution, you can just add this to the POM's properties section. However, local settings like this usually go to settings.xml file in the conf dir inside your maven installation. This will make this property always present no matter what pom you use. Or, if you skip the activeProfiles part, you'll have to invoke maven with that profile enabled - "mvn -pandroidProfile clean install".
<profiles>
<profile>
<id>androidProfile</id>
<properties>
<android.sdk.path>your/path/here</android.sdk.path>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>androidProfile</activeProfile>
</activeProfiles>