This article describes how to install artifacts into Maven from the source code. To start with you should have installed Maven and downloaded the source code you want to install. This same mechanism can be used for library jar files to archetypes that you want to install.

  1. Open a command prompt and navigate to the directory where the Maven source code is. This is usually indicated by the presence of a pom.xml file in that directory.
    
    > cd dev\projects\myproject
    
  2. Once in the maven project folder, there are a number of different commands you can use to install the project depending on what you need. The simplest form will compile, test, and install the artifacts into Maven.
    
    >mvn install
    

In some cases, you want to install the source and java doc files as well as the main jar file. This can be done by adding it onto the command line.


>mvn javadoc:jar source:jar install

There may be times you want to make sure your build is completely clean before you start. You can do this by adding the clean target onto the command. This deletes any current compiled sources so they will be regenerated from scratch.


>mvn clean javadoc:jar source:jar install

While we added it at the start of the command, you don’t need to, you can put it at the end and it will still be executed first.

Skipping Tests

If you need to skip tests, you can do so by setting a command line parameter on the command line depending on how you want to skip the tests. While skipping tests is not advised, there are many cases where you might need to do so.

-Dmaven.test.skip=true

This will skip the compilation and execution of the tests.

-DskipTests=true

This will compile the tests, but skip the execution of them.

See here for more information on controlling test skipping in the pom.xml file.