How Maven publishes local projects to archiva


Many times, we may not want to publish our build code to a public Maven repository.

How to use Maven to publish some private projects to archiva.

This is actually quite simple.

You need to meet the following three conditions.

  1. A maven warehouse with publishing authority
  2. At settings.xml Configure the user name and password that you can access this repository
  3. Configure your pom.xml Documents.

After the configuration is successful, you can run MVN clean deploy to publish.

Specifically, for a condition, the simplest way to deploy a local archiva is to publish the Maven repository.

For example, the warehouse address we use is This is the address of our private repository for testing and publishing. Of course, you can also use other servers or commercial services.

How Maven publishes local projects to archiva

At settings.xml You need to configure ID, user name and password.

Here you need to use the real user name and password of archiva.

How Maven publishes local projects to archiva

Modify the pom.xml Documents.

Add the following:

        <name>Internal Release Repository</name>
        <name>Internal Snapshot Repository</name>

Here is the link address of the warehouse you want to publish to.

How Maven publishes local projects to archiva

Then you can directly run MVN clean deploy for deployment.

The output is:

C:\WorkDir\Repository\cwiki-us-demo\java-tutorials>mvn clean deploy
[INFO] Scanning for projects…
[INFO] ———————-< com.ossez:parent-modules >———————-
[INFO] Building parent-modules 1.0.0
[INFO] ——————————–[ pom ]———————————
[INFO] — maven-clean-plugin:2.5:clean (default-clean) @ parent-modules —
[INFO] — maven-install-plugin:2.4:install (default-install) @ parent-modules —
[INFO] Installing C:\WorkDir\Repository\cwiki-us-demo\java-tutorials\pom.xml to C:\Users\yhu\.m2\repository\com\ossez\parent-modules\1.0.0\parent-modules-1.0.0.pom
[INFO] — maven-deploy-plugin:2.7:deploy (default-deploy) @ parent-modules —
Uploading to…
Uploaded to… (9.2 kB at 12 kB/s)
Downloading from…
Downloaded from… (331 B at 150 B/s)
Uploading to…
Uploaded to… (330 B at 914 B/s)
[INFO] ————————————————————————
[INFO] ————————————————————————
[INFO] Total time: 4.573 s
[INFO] Finished at: 2020-04-10T15:13:36-04:00
[INFO] ————————————————————————


Then you can go to the server to see if your file has been published successfully.

How Maven publishes local projects to archiva