How can I configure GITLAB CI with NEXUS? - maven

I want to create a pipeline with Gitlab CI to compile a maven project.
First, I create a .m2 folder in root of my project and I add the settings.xml config file.
My project look like :
Project
- module1
- module2
- module3
- pom.xml
- .m2
-setting.xml
In the settings file I do this :
<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">
<servers>
<server>
<id>nichefactory-releases</id>
<username>user</username>
<password>password</password>
</server>
<server>
<id>nichefactory-snapshots</id>
<username>user</username>
<password>password</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<properties>
<env>dev</env>
<flex.debug>true</flex.debug>
</properties>
<repositories>
<repository>
<id>nichefactory</id>
<name>NicheFactory Repository</name>
<url>http://my-nexus:8081/nexus/content/groups/public</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>
In my pom.xml I have this repository :
<distributionManagement>
<!-- Publish the versioned releases to nexus -->
<repository>
<id>nichefactory-releases</id>
<name>Niche Factory Repository (RELEASE)</name>
<url>http://my-nexus:8081/nexus/content/repositories/releases</url>
</repository>
<!-- Publish the snapshot release to nexus -->
<snapshotRepository>
<id>nichefactory-snapshots</id>
<name>Niche Factory Repository (SNAPSHOTS)</name>
<url>http://my-nexus:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
And in my .gitlab-ci.yml I have :
image: maven:latest
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
build:
stage: build
script:
- mvn compile -P dev -DskipTests
When I push this config to gitlab, the pipeline start with a failure message :
Failure to find apps:pom:version in https://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 and 'parent.relativePath' points at wrong local POM # line 4, column 10
It seems that gitlab try to connect to the default maven repository and not to my nexus.
How can I tell gitlab to call the nexus repository and not the default repository ?

MAVEN_CLI_OPTS is not an official MAVEN environment variable, but the recommended way to store repeating options. you can even see this in the GitLab Example
Just try:
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS compile -P dev -DskipTests

Related

Github action cannot download artifact from Github package repository

I have two different repositories. One for the library an another for the application that needs the library from the other repository. When I run the Github action of the second repository I got a
Authentication failed for https://maven.pkg.github.com/XXXX/YYYY/file.pom 401 Unauthorized
I tried already to change the maven settings with (this is working when I change my local maven settings and install my application):
- uses: DamianReeves/write-file-action#v1.0
with:
path: ~/.m2/settings.xml
contents: ${{ secrets.MAVEN_SETTINGS }}
write-mode: overwrite
Settings.xml file was:
<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">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>USERNAME</username>
<password>TOKEN</password>
</server>
</servers>
</settings>
Also I tried using maven-settings-action:
- name: Configure Maven
uses: s4u/maven-settings-action#v2.2.0
with:
servers: |
[{
"id": "imdb-github",
"username": "${{ secrets.MAVEN_USERNAME }}",
"password": "${{ secrets.MAVEN_PASSWORD }}"
}]
I also tried to use the GITHUB_TOKEN for it but without any luck.
The pom.xml file of the project that needs the library has a repositories section that looks like:
<repositories>
<repository>
<id>imdb-github</id>
<url>https://maven.pkg.github.com/user/repo</url>
</repository>
</repositories>
Does somebody knows the solution for this?
I found the issue. My flow was using actions/cache after s4u/maven-settings-action. So the cache overwrite the settings file. Removing the actions/cache step the issue was resoled. Also swapping the actions/cache and s4u/maven-settings-action so that the maven-settings-action is after actions/cache has solved my issue.
In order to diagnose such issue, please run maven with debug options -X and diagnose logs which serverId is used.
mvn -X ...
Please also run the same on local environment.
Configuration look ok, so cause maybe wrong user name or password are provided

Github action push java artifact to github repo

I have a Github repo project using GitHub actions with a docker file used to build the SpringBoot Java project.
I want to download packages from the Github repo for custom artifacts from GitHub repo and also be able upload artifact to it.
So I followed the link Configuring Apache Maven for use with GitHub Packages by adding the section to a settings.xml file:
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>USERNAME</username>
<password>${GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
To publish the package from the dockerfile build I added the following to my pom.xml:
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
</repository>
</distributionManagement>
The following is the content of my dockerfile:
FROM adoptopenjdk/maven-openjdk10 as build
WORKDIR /app
ADD pom.xml /app/pom.xml
ADD src /app/src
ADD settings.xml /root/.m2/settings.xml
RUN ["mvn", "clean", "install", "deploy"]
Is it possible to deploy from the dockerfile to Github repo? Somehow the deploy piece does not seem to work. I have tried few times but not sure what's wrong with my sections.
Currently this is my error in my docker build:
Could not transfer metadata
com.chg.sa:demo-sa-java-service:1.0-SNAPSHOT/maven-metadata.xml
from/to github (https://maven.pkg.github.com/OWNER/REPOSITORY): Not
authorized -> [Help 1]
I got the push working using Dockerfile building by passing in the github token as build arg and switching the owner and repo name to their values.

How to see what Maven is sending to a server during deploy?

I'm trying to use Github's new Actions CI server to deploy packages to Github's new packages feature. It's not going well.
I think it's all set up correctly, but I get this error:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default-deploy) on project myproject: Failed to deploy artifacts: Could not
find artifact com.mycompany:myproject:pom:1.5 in github
(https://maven.pkg.github.com/mycompany/mycompany_repository) -> [Help 1]
This happens after it appears to upload that same pom successfully:
Uploading to github: https://maven.pkg.github.com/mycompany/mycompany_repository
/com/mycompany/myproject/1.5/myproject-1.5.pom
Progress (1): myproject-1.5.pom (4.1/6.1 kB)
Progress (1): myproject-1.5.pom (6.1 kB)
So, it looks to me like it is successfully uploading the pom, but then it fails to download the same pom a few seconds later.
I'm running the deploy with debug switches on: mvn -X -e deploy, but I can't see the exact http commands that Maven is sending to the server.
How do I debug this? Is there some Maven/Aether transport or something that will log what is going on under the covers?
In case anyone else lands here looking for a solution to OPs issue publishing to github, I had a similar issue and found that the URLs needed in settings.xml and pom.xml are inconsistent. In your settings.xml, the repo URL needs to be of the form https://maven.pkg.github.com/myuser/com/mycompany/mypackage, whereas in your project's pom file, it needs to be of the form https://maven.pkg.github.com/myuser/mypackage. So, for example, your settings.xml file in ~/.m2 would look something like this:
<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">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/myuser/com/mycompany/mypackage</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>myuser</username>
<password>mypersonalaccesstoken</password>
</server>
</servers>
</settings>
Whereas the pom.xml file in the root of your project would need to look like this:
<project>
...
<groupId>org.mycompany</groupId>
<artifactId>mypackage</artifactId>
<version>1.0.0</version>
...
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/myuser/mypackage</url>
</repository>
</distributionManagement>
...
</project>
Other than this minor (but crucial) detail, my steps were the same as those outlined here. This allowed me to publish my Maven package to github package registry.
You can enable debug logging in the workflows.
Just add the secret:
ACTIONS_RUNNER_DEBUG
And set to true
See a similar answer here
I just spend 3 hours debugging why the guide on the page did not work for me. If you are following the guide posted here 1.
OWNER is your github username, and REPOSITORY is - you guessed it, the repo name.
Just remember to use lowercase in both OWNER and REPOSITORY.
When generating the personal access token, make sure the scopes for the token are the repo:* scopes as well as the more obvious write:packages and read:packages scopes (do not disable the repo scopes)
Otherwise it does just that
The following solution works for me:
Create a repository for packages e.g. maven-packages
Add <server></server> settings under <servers> in settings.xml: (do this per id used below)
<server>
<id>github</id>
<username>YOUR GITHUB USERNAME</username>
<password>A GITHUB TOKEN YOU CREATE FOR PUBLISHING PACKAGES</password>
</server>
Do NOT add <activeProfiles>, <profile> or <repositories> to settings.xml (only add <server> elements) as this is redundant for publishing and I am adding them to consuming projects' maven.xml so no need for duplication.
Add repository/ies to distributionManagement in pom.xml as follows:
<distributionManagement>
<snapshotRepository>
<id>github-snapshot</id>
<name>GitHub snapshot</name>
<url>https://maven.pkg.github.com/OWNER/maven-packages/</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
<repository>
<id>github-release</id>
<name>GitHub release</name>
<url>https://maven.pkg.github.com/OWNER/maven-packages/</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>
Where OWNER is the GitHub account your project is / projects are under and maven-packages is the repositories you want to publish you project(s) to.
This enables using a dedicated repository for listing packages instead of publishing each project's package to a different (its own) repository, making consumption of multiple packages from your GitHub account easier, as you only need to configure a single repository for these packages:
<repositories>
<repository>
<id>github</id>
<name>GitHub</name>
<url>https://maven.pkg.github.com/OWNER/maven-packages/</url>
</repository>
</repositories>
Note: in the <servers> section of your settings.xml define a <server> per id used in repositories and distributionManagement e.g. github-snapshot, github-release, github in the above examples.

How to resolve a maven dependency in a bitbucket pipeline that exists in another repo

I'm setting up a deployment pipeline for my companys mulesoft APIs using bitbucket-pipelines. This technology is attractive to us because of the built in integrations with Jira. The problem is that we are using a domain project. All of the other dependencies get downloaded from anypoint exchange, but the domain project cannot be hosted there, so I get this error:
[ERROR] Failed to execute goal on project sourceControlDemo: Could not resolve dependencies for project com.mycompany:sourceControlDemo:mule-application:1.0.0-SNAPSHOT: Could not find artifact com.mycompany:[mycompany]-domain:jar:mule-domain:1.0.0 in anypoint-exchange (https://maven.anypoint.mulesoft.com/api/v1/maven) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project sourceControlDemo: Could not resolve dependencies for project com.mycompany:sourceControlDemo:mule-application:1.0.0-SNAPSHOT: Could not find artifact com.mycompany:[mycompany]-domain:jar:mule-domain:1.0.0 in anypoint-exchange (https://maven.anypoint.mulesoft.com/api/v1/maven)
In our current process, which involves building the projects locally, the domain project is included in the workspace and this error does not occur.
It seems as though there are a few strategies here:
* Create a custom docker image with the dependency included
- This options seems overkill, and presents the biggest skill gap for me, as I have never used docker.
* Host the domain project on a private maven repo to be referenced in the dependent project pom.xml
- This seems like the "normal" way to do it. However, it again seems like overkill for one dependency.
* Clone the domain project repo in the pipeline file, install the project in the local repository automatically
- this is the option I'd really like to go with. I've managed to clone the repo and run mvn install in its root, but upon running mule deploy in the next step, it still cannot find the dependency. I'm not sure what the file structure really looks like in the pipeline, and can't figure out how to configure the pom to look in the right place.
My bitbucket-pipelines.yml file
image: maven:3.6.1-jdk-8
pipelines:
branches:
DEV:
- step:
name: install domain project
trigger: automatic
caches:
- maven
script:
- apt-get update -y
- apt-get install -y git
- cd ..
- git clone git#bitbucket.org:[mycompany]/[mycompany]-domain.git
- cd [mycompany]-domain
- mvn install
- cd ../build
- step:
name: Build and Deploy
trigger: automatic
caches:
- maven
deployment: DEV
script:
- mvn deploy -e -DmuleDeploy
My pom.xml file for the non domain project
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>sourceControlDemo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
<name>sourceControlDemo</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<app.runtime>4.1.5</app.runtime>
<mule.maven.plugin.version>3.2.7</mule.maven.plugin.version>
</properties>
<build>
<finalName>${artifactId}-${BITBUCKET_BUILD_NUMBER}</finalName>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<armDeployment>
<uri>https://anypoint.mulesoft.com</uri>
<target>${target}</target>
<targetType>${target_type}</targetType>
<username>${username}</username>
<password>${password}</password>
<environment>${environment}</environment>
<muleVersion>4.1.5</muleVersion>
</armDeployment>
</configuration>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>[mycompany]-domain</artifactId>
<version>1.0.0</version>
<classifier>mule-domain</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>anypoint-exchange</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v1/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>https://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
I've also tried this in the pom:
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>[mycompany]-domain</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<type>jar</type>
<classifier>mule-domain</classifier>
<systemPath>${basepath}/.m2/repository</systemPath>
</dependency>
and got this error
[ERROR] Failed to execute goal on project sourceControlDemo: Could not resolve dependencies for project com.mycompany:sourceControlDemo:mule-application:1.0.0-SNAPSHOT: Could not find artifact com.mycompany:[mycompany]-domain:jar:mule-domain:1.0.0 at specified path /root/.m2/repository -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project sourceControlDemo: Could not resolve dependencies for project com.mycompany:sourceControlDemo:mule-application:1.0.0-SNAPSHOT: Could not find artifact com.mycompany:[mycompany]-domain:jar:mule-domain:1.0.0 at specified path /root/.m2/repository
In case it's not clear, I've censored my company's name.
The expected result is for the project to successfully build and deploy.
You can follow this article, to achieve it.
cloud-repo-and-bitbucket-example
Here is one way to do it. Works for me:
Add the settings.xml file and change your cloud repo user and password for bitbucket secure variables.
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd"
<!-- Complete Documentation for the settings.xml file can be found at https://maven.apache.org/settings.html -->
<activeProfiles>
<activeProfile>example</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>example</id>
<repositories>
<repository>
<id>${private_repo_id}</id>
<name>Example Java Repository</name>
<url>${private_repo_url}</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>io.cloudrepo</id>
<username>${prived_user_repo}</username>
<password>${prived_password_repo}</password>
</server>
</servers>
</settings>
Add those variables on your bitbucket pipeline
Add to your bitbucket-pipelines.yml the maven step including the setting.xml
image: maven:3.6.1
pipelines:
default:
- step:
caches:
- maven
script:
- mvn -s settings.xml -B verify
This following works when an external repository is not the preferred approach.
Create a key pair in the repository which should consume the other dependency (the main project): https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
Add the public key as access key to the projects which is the dependency (the dependency): https://confluence.atlassian.com/bitbucket/use-access-keys-294486051.html
Configure the build pipeline based on the maven Docker image (adjust to the latest version provided by Bit Bucket). Pay attention to the first step, which is not executed in parallel building the necessary dependency before the main project is built.
image: maven:3.6.3
pipelines:
default:
- step:
name: Build Local Dependencies
caches:
- maven
script:
- git clone git#bitbucket.org:<user>/<project>.git
- cd <project>
- mvn clean install
- cd ..
- parallel:
- step:
name: Build and Test
caches:
- maven
script:
- mvn -B verify --file pom.xml
after-script:
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
- pipe: atlassian/checkstyle-report:0.3.0
- step:
name: Security Scan
script:
# Run a security scan for sensitive data.
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
- pipe: atlassian/git-secrets-scan:0.5.1
I fixed mine by using
mule.maven.plugin.version 3.8.3
setting the image in the pipeline to: image: maven:3.8.4-openjdk-8
I read in a different blog that jdk is the issue, moving from default maven image maven:3.8.4 to maven:3.8.4-openjdk-8, it fixed my issue.

Copy snapshot artifact from nexus without pom

I want to download a snapshot artifact using the dependecy.copy target. I don't want to have a POM file.
mvn -U dependency:copy -Dartifact=mygroupId:myArtifactId:myversion-SNAPSHOT:jar
Unfortunately this only works if the artifact is already in the local maven repo cache. When it's not in the maven cache I get the following error:
Unable to find artifact.
...
foo-public (https://nexus.foo.org/content/groups/public-foo/, releases=true, snapshots=false)
It says foo-public because I'm using a settings.xml
<mirror>
<id>foo</id>
<mirrorOf>*</mirrorOf>
<name>My Maven Nexus Repository</name>
<url>http://nexus.foo.org/content/groups/public-foo/</url>
</mirror>
The reason seems to be that Maven's Super POM has set snapshots=false for the central repo. If I add a minimalistic pom.xml to the working directory I don't have the error as snapshots=true seems to be the default for any other repo.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>dummy</groupId>
<artifactId>dummy</artifactId>
<version>1</version>
<repositories>
<repository>
<id>dummy</id>
<url>dummy</url>
</repository>
</repositories>
</project>
My current work around is to write the dummy POM before calling my mvn command. Another possible work around is to add the following to settings.xml (Found in Sonatype nexus book)
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
Do you have a more elegant idea that works without so much preparation? For instance a command line switch?
One solution is to use dependency:get goal instead of dependeny:copy goal, see Apache Maven Dependency Plugin:
The dependency:get Mojo
This mojo is used to fetch an artifact and (optionally) its dependencies from remote repositories using its Maven coordinates.
mvn dependency:get -DgroupId=org.apache.maven -DartifactId=maven-core -Dversion=2.2.1 -Dpackaging=jar -Dclassifier=sources -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,myrepo::::http://myrepo.com/maven2
mvn dependency:get -DgroupId=org.apache.maven -DartifactId=maven-core -Dversion=2.2.1 -Dpackaging=jar -Dclassifier=sources -DremoteRepositories=http://repo1.maven.apache.org/maven2
mvn dependency:get -Dartifact=org.apache.maven:maven-core:2.2.1:jar:sources -DremoteRepositories=http://repo1.maven.apache.org/maven2 -Ddest=/tmp/myfile.jar
Your modified command:
mvn dependency:get -U -DgroupId=mygroupId -DartifactId=myArtifactId -Dversion=myversion-SNAPSHOT -Dpackaging=jar -Dtransitive=false -s settings.xml -DremoteRepositories=https://nexus.foo.org/content/groups/public-foo/ -Ddest=target/myArtifactId.jar

Resources