So my problem is the following, I have a freshly installed Nexus 3 instance running in a Docker Container inside my Portainer instance. Currently I'm developing a Java Library that I build with Maven. I want to upload my build artifacts via Gitlab CI to Nexus to store and reuse them. In the following you can find my configuration for my Java Project, Gitlab CI Script and what my Nexus looks like.
Nexus:
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.kryofex</groupId>
<artifactId>PluginAPI</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<distributionManagement>
<!--<snapshotRepository>
<id>nexus-snapshots</id>
<url>${nexus.url}/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>${nexus.url}/repository/maven-releases/</url>
</repository>-->
<repository>
<id>central</id>
<name>Central</name>
<url>${env.NEXUS_REPO_URL}central/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>${env.NEXUS_REPO_URL}snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
</dependencies>
.m2/settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${env.NEXUS_REPO_USER}</username>
<password>${env.NEXUS_REPO_PASS}</password>
</server>
<server>
<id>snapshots</id>
<username>${env.NEXUS_REPO_USER}</username>
<password>${env.NEXUS_REPO_PASS}</password>
</server>
</servers>
</settings>
.gitlab-ci.yml:
image: maven
variables:
SNAPSHOT_DEPLOYMENT_REPOSITORY: ${NEXUS_REPO_URL}/repository/maven-snapshots/
RELEASE_DEPLOYMENT_REPOSITORY: ${NEXUS_REPO_URL}/repository/maven-releases/
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode --errors --fail-at-end --show-version"
MAVEN_CLI_POST_OPTS: "-Dnexus.url=${NEXUS_REPO_URL} -Dmaven.repo.local=.m2"
cache:
paths:
- .m2/repository/
- target/
stages:
- build
- test
- package
- deploy
codebuild:
stage: build
script:
- mvn install
- mvn compile
codetest:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
- echo "The code has been tested"
codepackage:
stage: package
script:
- mvn $MAVEN_CLI_OPTS package -Dmaven.test.skip=true
- echo "Packaging the code"
artifacts:
paths:
- target/*.jar
only:
- master
codedeploy:
stage: deploy
script:
- mvn -v
- mvn $MAVEN_CLI_OPTS source:jar deploy -Dnexus_user=${NEXUS_REPO_USER} -Dnexus_pwd=${NEXUS_REPO_PWD} -DsnapshotDeploymentRepository=$SNAPSHOT_DEPLOYMENT_REPOSITORY -DreleaseDeploymentRepository=$RELEASE_DEPLOYMENT_REPOSITORY -DskipTests ${MAVEN_CLI_POST_OPTS}
- echo "installing the package in local repository"
only:
- master
When I run my pipeline with this configuration everything works fine besides the deployment. In this stage Gitlab throws an Error:
[INFO] Uploading to central: http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.jar
[INFO] Uploading to central: http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2020-12-27T14:58:42Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project PluginAPI: Failed to deploy artifacts: Could not transfer artifact de.kryofex:PluginAPI:jar:1.0.0 from/to central (http://78.46.71.23:49155/central/): Transfer failed for http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.jar: Connect to 78.46.71.23:49155 [/78.46.71.23] failed: Connection timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project PluginAPI: Failed to deploy artifacts: Could not transfer artifact de.kryofex:PluginAPI:jar:1.0.0 from/to central (http://78.46.71.23:49155/central/): Transfer failed for http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.jar
What can I do to fix this Error ? I thought maybe is my URL (selfhosted Nexus) to the repository wrong or I missed some Nexus configuration. I have worked with Nexus before at my workplace but I have never configured an Nexus instance so maybe I missed something ?
THank you in advance
Related
I have a .jar file that I want to upload to Maven Central using Travis. The Jira ticket to create an account was sent to Sonatype by my company, and the account has been created.
The command I have put in the Travis script to upload the artifact is the following:
mvn gpg:sign-and-deploy-file \
-DpomFile=stuff/pom.xml \
-Dfile=_build/java/Packager.jar \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=maven-central \
-Dgpg.passphrase=${mvn_passphrase}
The output of the command ends with the following error:
Uploading to maven-central: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect-sdk/18.0/connect-sdk-18.0.jar
Uploading to maven-central: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect-sdk/18.0/connect-sdk-18.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.115 s
[INFO] Finished at: 2020-01-15T16:48:51Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign-and-deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact com.cloudblue:connect-sdk:jar:18.0 from/to maven-central (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Transfer failed for https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect-sdk/18.0/connect-sdk-18.0.jar 400 Bad Request -> [Help 1]
These are the contents of the ~ /.m2/settings.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>maven-central</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-central</activeProfile>
</activeProfiles>
<servers>
<server>
<id>maven-central</id>
<!-- These will be replaced by the proper env vars by the Travis script -->
<username>__USER__</username>
<password>__PASSWORD__</password>
</server>
</servers>
</settings>
And this is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cloudblue</groupId>
<artifactId>connect-sdk</artifactId>
<version>18.0</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>Connect Java SDK autogenerated from Haxe sources.</description>
<url>https://github.com/cloudblue/connect-java-sdk</url>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>CloudBlue</name>
<email>connect-service-account#ingrammicro.com</email>
<organization>CloudBlue</organization>
<organizationUrl>https://www.cloudblue.com/</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/cloudblue/connect-java-sdk.git</connection>
<developerConnection>scm:git:ssh://github.com:cloudblue/connect-java-sdk.git</developerConnection>
<url>https://github.com/cloudblue/connect-java-sdk</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
<executions>
<execution>
<configuration>
<repositoryId>maven-central</repositoryId>
<file>connect.jar</file>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin-version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>maven-central</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>maven-central</id>
<name>Snapshot</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>maven-central</id>
<name>Release</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
Could someone provide guidance on what could be the cause of the 400 error?
EDIT: I found out the cause of one of the problems. The groupId was not set to the proper value when creating the Sonatype account. It has been fixed. Now, using the deploy:deploy-file goal uploads the packages correctly, but using the gpg:sign-and-deploy-file one to sign and upload the files raises the following error:
Uploading to connect: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.jar
Uploaded to connect: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.jar (374 kB at 19 kB/s)
Uploading to connect: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.pom
Uploaded to connect: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.pom (3.7 kB at 6.2 kB/s)
Downloading from connect: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/maven-metadata.xml
Downloading from connect: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.jar.asc
[WARNING] Could not transfer metadata com.cloudblue:connect.sdk:18.0/connect.sdk-18.0.jar.asc from/to connect (https://oss.sonatype.org/service/local/staging/deploy/maven2): Transfer failed for https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.jar.asc 400 Bad Request
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.511 s
[INFO] Finished at: 2020-01-17T08:00:16Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign-and-deploy-file (default-cli) on project standalone-pom: Failed to retrieve remote metadata com.cloudblue:connect.sdk:18.0/connect.sdk-18.0.jar.asc: Could not transfer metadata com.cloudblue:connect.sdk:18.0/connect.sdk-18.0.jar.asc from/to connect (https://oss.sonatype.org/service/local/staging/deploy/maven2): Transfer failed for https://oss.sonatype.org/service/local/staging/deploy/maven2/com/cloudblue/connect.sdk/18.0/connect.sdk-18.0.jar.asc 400 Bad Request -> [Help 1]
I ended up using the REST API to upload all the artifacts and it worked wonderfully. Maven seemed to be working randomly. Sometimes it was uploading the signature files, most times it wasn't.
For anyone having the same question, we did the following:
Sign and Deploy to a local directory:
e.g. mvn gpg:sign-and-deploy-file -e -X -Durl="file:///tmp"
Upload to maven with curl: see:
https://support.sonatype.com/hc/en-us/articles/213465868-Uploading-to-a-Staging-Repository-via-REST-API
I was silly enough to include the path to my project pom.xml instead of the jar pom in the pomFile param, which also caused this error.
Hope to help some of my peers out with this.
I'm trying to explore maven as download tool as this helps in local caching as well connecting central/remote repository. I am able to download artifact from remote repository. But every time it downloads to target location but it doesn't look .m2 repository or updates there. I believe there is some setting which i am missing in setting.xml or pom.xml.
What goal i intend is download to check if already artifact is present in local repository can be .m2 or a predefined one and if not then only download from artifactory.
Maven Command Used :
mvn install pre-integration-test -f pom_download.xml -settings settings.xml -Dmayank=test.txt
output :
[INFO] --- wagon-maven-plugin:2.0.0:download-single (download-test-data) # testdownload ---
[INFO] Downloading: https://artifactory.com/artifactory/test.txt to C:\downloads\test.txt
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.830 s
[INFO] Finished at: 2019-10-04T06:34:40-07:00
[INFO] ------------------------------------------------------------------------
Setting.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
| -->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>https</protocol>
<host></host>
<port></port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
<proxy>
<id>optional_1</id>
<active>true</active>
<protocol>http</protocol>
<host></host>
<port></port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
<localRepository>C:\repo_mayank</localRepository>
<servers>
<server>
<id>ubit-artifactory-or</id>
<username>mayank</username>
<password>xxxxx</password>
</server>
</servers>
<profiles>
<profile>
<id>artifactory</id>
<repositories>
<repository>
<id>xxxx</id>
<name>xxxx</name>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>https://artifactory.com/</url>
<layout>default</layout>
</repository>
</repositories>
<mirrors>
<mirror>
<id>our-server-repo</id>
<name>C:\repo_mayank</name>
<url>https://artifactory.com/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
Pom.xml
?xml version='1.0' encoding='utf8'?>
<project>
<groupId>com.mayank</groupId>
<artifactId>testdownload</artifactId>
<version>1.0</version>
<modelVersion>4.0.0</modelVersion>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<id>download-test-data</id>
<phase>pre-integration-test</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<task>
<echo> Hello World !!!</echo>
</task>
<serverId>artifactory</serverId>
<url>https://artifactory.com</url>
<fromFile>${mayank}</fromFile>
<toDir>C:\downloads</toDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<mayank> hello </mayank>
</properties>
</project>
It looks like the maven wagon plugin doesn't use the maven cache at all. If you want to download artifacts linked to your project you can use the maven dependency plugin and use copy-dependencies goal. If you just want to copy some artifacts use the copy goal. More info: http://maven.apache.org/plugins/maven-dependency-plugin/ Either way you have to specify what you want in your pom.
I have a maven multimodule project composed of 7 projects
Parent Pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dag-app.dag</groupId>
<artifactId>dag-app</artifactId>
<version>3.0.0.RELEASE</version>
<packaging>pom</packaging>
<name>dag Parent application (pom)</name>
<description>dag parent pom application</description>
<properties>
<maven.resources.overwrite>true</maven.resources.overwrite>
<project.build.sourceEncdagng>UTF-8</project.build.sourceEncdagng>
<!-- temporarly disable tests -->
<maven.test.skip>true</maven.test.skip>
<argLine>-noverify</argLine>
<!-- other dependencies -->
</properties>
<dependencyManagement>
<dependencies>
<!-- business project dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-business</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- db repository project dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-db-repository</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- db model project dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-db-model</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- es repository dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-es-repository</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- es model dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-es-model</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- common dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- other dependencies -->
</dependencyManagement>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<pluginManagement>
<plugins>
<!-- compiler plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>../dag-common</module>
<module>../dag-es-model</module>
<module>../dag-db-model</module>
<module>../dag-es-repository</module>
<module>../dag-db-repository</module>
<module>../dag-business</module>
<module>../dag-rest</module>
</modules>
<!-- private application repository -->
<repositories>
<repository>
<id>privateRepo</id>
<name>privateRepo</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://rnexus.intra.dag.fr/rnexus/content/repositories/dag-projects/</url>
</repository>
<!-- local repo -->
<repository>
<id>localrepository</id>
<url>file://D:/Public/Dev/Repo/</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
</project>
The application compiles and build properly locally and using Jenkins
[INFO] Reactor Summary:
[INFO]
[INFO] dag Parent application (pom) ....................... SUCCESS [ 2.657 s]
[INFO] dag-common ......................................... SUCCESS [ 8.635 s]
[INFO] dag-es-model ....................................... SUCCESS [ 1.871 s]
[INFO] dag-db-model ....................................... SUCCESS [ 0.883 s]
[INFO] dag-es-repository .................................. SUCCESS [ 9.465 s]
[INFO] dag-db-repository .................................. SUCCESS [ 12.457 s]
[INFO] dag-business ....................................... SUCCESS [ 6.288 s]
[INFO] dag-rest ........................................... SUCCESS [ 31.430 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:14 min
[INFO] Finished at: 2018-07-27T10:33:28+02:00
[INFO] Final Memory: 47M/116M
[INFO] ------------------------------------------------------------------------
But then after the build we have a liquibase(mvn liquibase:update) task which fails
Entering stage LiquiBase Migration
Proceeding
[Pipeline] node
Running on Agent-s0066tts in /logiciel/work/f34668da/workspace/dag-65454/dag Performance
[Pipeline] {
[Pipeline] withCredentials
[Pipeline] {
[Pipeline] tool
[Pipeline] sh
[dag Performance] Running shell script
+ cd dag-db-repository
+ /logiciel/jenkins/apache-maven-3.3.9/bin/mvn liquibase:update
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building dag-db-repository 3.0.0.RELEASE
[INFO] ------------------------------------------------------------------------
Downloading: http://rnexus.intra.dag.fr/rnexus/content/groups/dag-entry/dag-app/dag/dag-db-model/3.0.0.RELEASE/dag-db-model-3.0.0.RELEASE.pom
Downloading: http://rnexus.intra.dag.fr/rnexus/content/repositories/releases/dag-app/dag/dag-db-model/3.0.0.RELEASE/dag-db-model-3.0.0.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.102 s
[INFO] Finished at: 2018-07-27T10:33:35+02:00
[INFO] Final Memory: 10M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project dag-db-repository: Could not resolve dependencies for project dag-app.dag:dag-db-repository:jar:3.0.0.RELEASE: Could not find artifact dag-app.dag:dag-db-model:jar:3.0.0.RELEASE in dagMirror (http://rnexus.intra.dag.fr/rnexus/content/groups/dag-entry/) -> [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/DependencyResolutionException
There is the pom of the db-repository which have db-model as a dependency
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- parent -->
<parent>
<groupId>dag-app.dag</groupId>
<artifactId>dag-app</artifactId>
<version>3.0.0.RELEASE</version>
<relativePath>../dag-app</relativePath>
</parent>
<!-- current module -->
<name>dag-db-repository</name>
<description>database layer of the application(data-access-object)</description>
<artifactId>dag-db-repository</artifactId>
<packaging>jar</packaging>
<dependencies>
<!-- db model dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-db-model</artifactId>
</dependency>
<!-- other dependencies -->
</dependencies>
<!-- build plugin -->
<build>
<!-- compiler plugin inherited from parent -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArguments>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>
</configuration>
</plugin>
<!-- liquibase migration DB plugin -->
<!-- problem is here -->
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<propertyFile>src/main/resources/liquibase/liquibase.properties</propertyFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<executions>
<execution>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
As you can see it fails when executing liquibase-maven-plugin
I don't understand why maven try to rebuild the project when executing this plugin because it's juste a database scripts update
It fails because it try to build a single module so obviously it cannot find the dag-db-model module and try to download it from remote
I can reproduce this error locally by removing dab-db-model from my local repo and doing a mvn clean install or mvn liquibase:update on the dab-db-repository module
How can i avoid the rebuild of the dab-db-repository module when executing the liquibase task or at least do not redownload dependencies ( because the full build of the application was already OK)
Thank you very much
I am running the "hello world" canned project off of spring.io (https://spring.io/guides/gs/rest-service/).
I am using JDK7 and Maven 3.0.3. I have cleared my local maven repo entirely to start with a clean slate. The build fails consistently with the message:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-resources-plugin:2.6:resources
(default-resources) on project gs-rest-service: Execution
default-resources of goal
org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed:
Unable to load the mojo 'resources' in the plugin
'org.apache.maven.plugins:maven-resources-plugin:2.6'. A required
class is missing: org/codehaus/plexus/util/Scanner
With "mvn -X clean install", I get a detailed report, excerpts from which are given below:
$ mvn -X clean install
//...
Downloaded:
https://repo.spring.io/libs-release/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
(60 KB at 116.9 KB/sec) Feb 08, 2015 2:26:54 PM
org.sonatype.guice.bean.reflect.NamedClass WARNING: Error injecting:
org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: org/codehaus/plexus/util/Scanner //...
Caused by: java.lang.ClassNotFoundException:
org.codehaus.plexus.util.Scanner
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 73 more
[INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE //...
My pom.xml is as follows:
//... org.springframework
gs-rest-service
0.1.0
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.10.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> <repositories>
<repository>
<id>plexus-releases</id>
<url> http://mirrors.ibiblio.org/pub/mirrors/maven2/
</url>
</repository>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>plexus-releases</id>
<url>http://search.maven.org/</url>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
Any help greatly appreciated - I have tried cleaning the repo, adding the dependencies specifically for the plugin - all of no avail.
Thanx - Kobe
I am new to Maven and I have seen many similar posts as mine, but I could not get my problem resolved.
I have a Maven project which has Maven Dependencies on other Maven Projects.
However, while carrying out Maven Build on the project with the goal being 'package' I get the following trace.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building docsvcs 1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.idiginfo.docsvc:models:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:apisvc:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:repositories:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:views:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:wok_v3:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:harvest:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:controllers:jar:1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.270s
[INFO] Finished at: Mon Mar 03 14:23:34 EST 2014
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project docsvcs: Could not resolve dependencies for project org.idiginfo.docsvc:docsvcs:war:1: The following artifacts could not be resolved: org.idiginfo.docsvc:models:jar:1, org.idiginfo.docsvc:apisvc:jar:1, org.idiginfo.docsvc:repositories:jar:1, org.idiginfo.docsvc:views:jar:1, org.idiginfo.docsvc:wok_v3:jar:1, org.idiginfo.docsvc:harvest:jar:1, org.idiginfo.docsvc:controllers:jar:1: Failure to find org.idiginfo.docsvc:models:jar:1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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.
I carried out the Maven clean followed by Maven Update Project.
Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>docsvcs</artifactId>
<packaging>war</packaging>
<parent>
<groupId>org.idiginfo.docservice</groupId>
<artifactId>service</artifactId>
<version>1</version>
<relativePath>../service</relativePath>
</parent>
<build>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warName>docsvcs</warName>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<dependentWarExcludes>WEB-INF/web.xml,**/**.class</dependentWarExcludes>
<webResources>
<resource>
<!-- change if necessary -->
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
<resource>
<directory>../repositories/src/META-INF</directory>
<!-- override the destination directory for this resource -->
<targetPath>WEB-INF/classes/META-INF</targetPath>
<includes>
<include>persistence.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>models</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>apisvc</artifactId>
<version>1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>repositories</artifactId>
<version>1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>views</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>wok_v3</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>harvest</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>controllers</artifactId>
<version>1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
</project>