Upload Artifacts Using the Maven Command-Line Interface

You can also use the Maven command-line interface to upload artifacts to the project’s Maven repository.

The Maven repository URL is available on the Project Home page of your project. Use the dav: URL to upload files and the http:// URL to view them in the browser.

Note that the credentials in settings.xml aren’t required to access the project Maven repository when running a build. The build job has full access to the project Maven repository for uploads and downloads.

  1. Download and install Maven on your local computer.
    You can download Maven from http://maven.apache.org/download.cgi.
  2. Open MVN_HOME/conf/settings.xml in a text editor and make the following changes.
    1. Specify the proxy server, if necessary.
      Example:
      <proxies>
      	<proxy>
      		<active>true</active>
      		<protocol>http</protocol>
      		<host>PROXY_URL</host>
       		<port>80</port>
       		<nonProxyHosts>www.anything.com|*.somewhere.com</nonProxyHosts>
       	</proxy>
      </proxies>
    2. Specify a unique ID and your VB Studio user name and password to access the project Maven repository.
      Example:
      <servers>
      	<server>
      		<id>remoteRepository</id>
      		<username>USERNAME</username>
      		<password>PASSWORD_IN_PLAINTEXT</password>
      	</server>	
      </servers>
    3. Specify a unique ID, name, and URL for the project Maven repository. You can copy the Maven repository URL from the Repositories tab of the Project Home page.
      Example:
      <profiles>
      	<profile>
      		<id>default</id>
      		<repositories>
      			<repository>
      				<id>remoteRepository</id>
      				<name>My Remote Repository</name>
      				<url>dav:https://developer.us2.oraclecloud.com/……/maven/</url>
      				<layout>default</layout>
      			</repository>
      		</repositories>
      	</profile>
      </profiles>
  3. Open the command-line and follow these commands to upload files to the hosted Maven repository. Ensure that the MVN_HOME/bin path is available in the PATH variable.
    1. Navigate to the directory that contains the files that you want to upload.
    2. Create the pom.xml file, if it hasn’t been created already.
      For more information about pom.xml, see http://maven.apache.org/guides/introduction/introduction-to-the-pom.html.
    3. Run the mvn deploy command to upload files.
      Example: mvn deploy:deploy-file -DpomFile=c:\myproject\pom.xml -Dfile=c:\myproject\myfile.jar -DrepositoryId=remoteRepository -X -Durl=dav:https://developer.us2.oraclecloud.com/……/maven/