Mvn Deploy Adding Version to File Upload

Once the repository manager is configured to receive components in the staging suite every bit documented in Configuring the Staging Suite, you will take to update your project build configuration to deploy to the staging suite.

The preferred way to do this is to take advantage of the features provided by the Nexus Staging Maven plugin or the Nexus Staging Emmet tasks as documented in Deployment with the Nexus Staging Maven Plugin and Deployment with the Nexus Staging Emmet Tasks.

If you need to continue to use the Maven Deploy plugin, you can read virtually using it with the staging suite in Deployment with the Maven Deploy Plugin.

With all tools you can use the manual upload of your components documented in Manually Uploading a Staged Deployment.

Deployment with the Nexus Staging Maven Plugin

The Nexus Staging Maven plugin is a specific and more powerful replacement for the Maven Deploy plugin with a number of features specifically geared towards usage with the staging suite. The simplest usage can be configured by adding it to the project build plugins section as an extension:

<build>   <plugins>     <plugin>       <groupId>org.sonatype.plugins</groupId>       <artifactId>nexus-staging-maven-plugin</artifactId>       <version>1.half-dozen.half-dozen</version>       <extensions>truthful</extensions>       <configuration>         <serverId>nexus</serverId>         <nexusUrl>http://localhost:8081/nexus/</nexusUrl>       </configuration>     </plugin>

It is important to use a version of the plugin that is compatible with your Nexus Repository Manager Pro server. Version 1.two is compatible with Nexus Repository Manager Pro ii.3, Version 1.iv.4 is compatible with Nexus Repository Managing director Pro ii.4, Version 1.four.8 is compatible with Nexus Repository Manager Pro 2.5 and 2.half dozen. 1.5 and 1.6.x can exist used for Nexus Repository Manager Pro 2.7 to 2.ten. The latest version of the plugin available is ever compatible with the latest available version of Nexus Repository Manager Pro. Try to use the newest possible plugin version to take advantage of any bachelor improvements.

Following Maven best practices, the version should be pulled out into apluginManagement section in a company POM or parent POM.

This configuration works only in Maven 3 and automatically replaces the deploy goal invocation of the Maven Deploy plugin in the deploy Maven life cycle phase with the deploy goal invocation of the Nexus staging Maven plugin.

The minimal required configuration parameters for the Nexus Staging Maven plugin are:

serverId

Theid of theserver element insettings.xml from which the user credentials for accessing the repository manager should exist retrieved.

nexusUrl

The base URL at which the repository manager to exist used for staging is available.

With this configuration the Nexus Staging Maven plugin will phase the components locally and connect to the repository director. Information technology volition try to make up one's mind the appropriate staging profile by matching the component path with any repository targets configured with staging profiles with an activated implicit contour pick strategy. If an advisable staging profile is found, a staging repository is created on the wing and the components are deployed into information technology. If no profile is found, the upload will fail.

To successfully deploy to your repository managing director, you will need to update your Maven Settings with the credentials for the deployment user. These credentials are stored in the Maven Settings file in~/.m2/settings.xml.

To add together these credentials, add the following element to the servers element in your~/.m2/settings.xml file as shown below:

<settings>   ...   <servers>     ...     <server>       <id>nexus</id>       <username>deployment</username>       <password>deployment123</password>     </server>   </servers>   ... </settings>

Note that the server identifier listed in Listing deployment credentials in Maven Settings should match the serverId parameter you lot are passing to the Nexus Staging Maven plugin and in the example contains the default password for the deployment user - "deployment123". You should modify this password to match the deployment countersign for your repository director.

If more than control is desired over when the plugins deploy goal is activated or if Maven 2 is used, you have to explicitly conciliate the Maven Deploy plugin and supervene upon the Maven Deploy plugin invocation with the Nexus Staging Maven plugin shown in the example below:

<build>   <plugins>     <plugin>       <groupId>org.apache.maven.plugins</groupId>       <artifactId>maven-deploy-plugin</artifactId>       <configuration>         <skip>true</skip>       </configuration>     </plugin>     <plugin>       <groupId>org.sonatype.plugins</groupId>       <artifactId>nexus-staging-maven-plugin</artifactId>       <executions>         <execution>           <id>default-deploy</id>           <phase>deploy</phase>           <goals>             <goal>deploy</goal>           </goals>         </execution>       </executions>       <configuration>         <serverId>nexus</serverId>         <nexusUrl>http://localhost:8081/nexus/</nexusUrl>         <!-- explicit matching using the staging profile id -->         <stagingProfileId>129341e09f2ee275</stagingProfileId>       </configuration>     </plugin> ...

The implicit matching relies on the setup of repository targets besides as the right order of staging profiles and is therefore an fault decumbent approach when many staging profiles are in use.

The preferred style to work in this scenario is to modify the profile selection strategy on all staging profiles to explicit just and pass the staging profile ID to the Nexus Staging Maven plugin using thestagingProfileId configuration parameter equally documented higher up. A total examplepom.xml for deployment of snapshot as well as release builds with the Nexus Staging Maven plugin using explicit matching for the staging profile and locally staged builds and atomic uploads is available in the examplepom.xml for Nexus Staging Maven Plugin below:

<projection>   <modelVersion>4.0.0</modelVersion>     <groupId>com.sonatype.training.nxs301</groupId>   <artifactId>explicit-staging-case</artifactId>   <version>1.0.0</version>     <distributionManagement>     <snapshotRepository>     <id>nexus-snapshots</id>     <url>http://localhost:8081/nexus/content/repositories/snapshots</url>     </snapshotRepository>   </distributionManagement>     <build>     <plugins>       <plugin>         <groupId>org.sonatype.plugins</groupId>         <artifactId>nexus-staging-maven-plugin</artifactId>         <version>1.half dozen.3</version>         <extensions>true</extensions>         <configuration>               <serverId>nexus-releases</serverId>           <nexusUrl>http://localhost:8081/nexus/</nexusUrl>           <!-- update this to the correct id! -->           <stagingProfileId>1296f79efe04a4d0</stagingProfileId>         </configuration>       </plugin>     </plugins>   </build> </project>

In order to deploy project components with the above setup you would invoke a build withmvn make clean deploy.

The build volition locally stage the components for deployment in target/nexus-staging on the console and create a airtight staging repository holding the build components. This execution of the deploy goal of the Nexus Staging Maven plugin performs the following actions:

  • Components are staged locally.
  • A staging profile is selected either implicitly or explicitly.
  • A staging repository is either created on the fly, if needed, or simply selected.
  • An atomic upload to the staging repository is performed.
  • The staging repository is closed (or dropped if upload fails).

The log of a successful deployment would look like to this:

[INFO] --- nexus-staging-maven-plugin:1.1.one:deploy (injected-nexus-deploy) @ staging-example --- [INFO] Using server credentials with ID="nexus-releases" from Maven settings. [INFO] Preparing staging against Nexus on URL http://localhost:8081/nexus/ [INFO] * Remote Nexus reported itself as version two.2.1 and edition "Professional" [INFO] * Using staging profile ID "12a1656609231352" (matched by Nexus). [INFO] Staging locally (stagingDirectory= "/Users/manfred/dev/explicit-staging-example/target/nexus-staging/12a1656609231352")... Uploading: file: ... explicit-staging-instance-1.0.0.jar Uploaded: file: ... explicit-staging-example-ane.0.0.jar (4 KB at 1051.1 KB/sec) Uploading: file: ... explicit-staging-example-1.0.0.pom Uploaded: file: ... explicit-staging-example-1.0.0.pom (4 KB at 656.two KB/sec) Downloading: file: ...maven-metadata.xml Uploading: file: ...maven-metadata.xml Uploaded: file: ... maven-metadata.xml (322 B at 157.2 KB/sec) [INFO] Staging remotely... [INFO] Uploading locally staged directory: 12a1656609231352 [INFO] Performing staging against Nexus on URL http://localhost:8081/nexus/ [INFO] * Remote Nexus reported itself as version 2.2.i and edition "Professional" [INFO] * Created staging repository with ID "examination-002", practical tags: {javaVersion=1.six.0_37, localUsername=manfred} [INFO] * Uploading locally staged components to: http://localhost:8081/nexus/service/local/staging/deployByRepositoryId/examination-002 [INFO] * Upload of locally staged components done. [INFO] * Closing staging repository with ID "test-002". [INFO] Finished staging against Nexus with success.

Failures are accompanied past mistake reports that reveal further details:

[ERROR] Fault while trying to shut staging repository with ID "test-003". [ERROR] [ERROR] Nexus Staging Rules Failure Report [Fault] ================================== [ERROR] [Fault] Repository "Test-003 (u:admin, a:127.0.0.1)" (id=n/a) failures [ERROR] Rule "RepositoryWritePolicy" failures [ERROR] * Artifact updating: Repository ='releases:Releases' does not allow updating artifact='/com/sonatype/training/nexus/explicit-staging-example/t1.0.0/staging-case-1.0.0.jar' [Fault] * Artifact updating: Repository ='releases:Releases' does not allow updating artifact='/com/sonatype/training/nexus/explicit-staging-case/1.0.0/staging-example-1.0.0.pom' [Error] [ERROR]

If the configuration parameterskipStagingRepositoryCloseis set totrue is passed to the plugin execution, the remote staging repository will non be closed.

Instead of repository manager creating a staging repository based on the implicit or explicit staging profile selection, you tin can explicitly configure the staging repository to use by providing the staging repository name as value of thestagingRepositoryId configuration property via the plugin configuration or command line invocation.

The identifier of a staging repository tin can be determined by looking at the name cavalcade in the list of staging repositories. The name column used the capitalized ID and adds the username and address the staging was deployed from in brackets. For case a proper noun could existTest-003 (u: admin, a: 127.0.0.1). The ID of this staging repository istest-003.

Together with skipping the closing of the repository usingskipStagingRepositoryClose, it is possible to go multiple builds to deploy to the same staging repository and, therefore, have a number of components become through the staging workflow together. An alternative to this approach would be to create an accumulation project that assembles all components together, due east.g., in an assembly and so use this project for staging.

Finally to override all staging, you can define the full repository URL to deploy to with thedeployUrl configuration parameter. For case, meet below:

http://localhost:8081/nexus/content/repositories/releases/

This would cause whatsoever staging to be skipped and a straight upload of the components to the repository to occur.

As part of the configuration section for the plugin y'all tin define tags with capricious key and value names. For case, y'all could create a tag with fundamentallocalUsername and a value of the current user picked upward from the USER environs variable:

... <configuration> ...   <tags>     <localUsername>${env.USER}</localUsername>     <javaVersion>${java.version}</javaVersion>   </tags> ...

Once components are released these tags are transformed into attributes stored forth the components in the release repository and tin exist accessed via the REST interface and, therefore, any plugin and user interface integration.

In addition to the to a higher place documented configuration options that make up one's mind the beliefs of the Nexus Staging Maven plugin, farther configuration can be provided with the post-obit parameters:

altStagingDirectory

Defaulting to target/nexus-staging you can gear up the property to set a different binder for the local staging.

autoReleaseAfterClose

If y'all set this flag to truthful , the staging repository will be airtight and, following a successful validation of all staging rules including potential Nexus IQ Server-based validation, released. By default this property is set tofake. Irresolute it totrue can exist a useful setup for continuous integration server based releases.

description

Allows you to provide a description for the staging repository action (similar shut or drop) carried out as function of the plugin
execution. The description volition then exist used in any notification but similar a description provided in the user interface.

keepStagingRepositoryOnFailure

Setting this flag to true will crusade the plugin to skip whatever clean upwardly operations like dropping a staging repository for failed uploads, by default these make clean up operations occur.

keepStagingRepositoryOnCloseRuleFailure

With the default setting offalse , the Nexus Staging Maven plugin volition driblet the created staging repository if any staging rule violation occurs. If this flag is set up totrue, it will not drop the staging repository. This allows y'all to inspect the deployed components in order to effigy out why a rule failed causing the staging failure.

skipStagingRepositoryClose

Set this to true to turn off the automatic closing of a staging repository after deployment.

skipNexusStagingDeployMojo

Gear up tosimulated by default, this flag will cause to skip any execution of the deploy goal of the plugin when set to truthful similar tomaven.deploy.skip. In multi-module builds the staging of all components is performed in the last module based on the reactor order. If this holding is set up to true in the module, all staging volition be skipped. Yous have to ensure that this belongings evaluates as truthful in the last module of the reactor. If necessary, you can add a dummy module.

skipStaging

Fix tofaux by default this flag volition crusade to skip any execution of the plugin when set to truthful.

skipRemoteStaging

If this flag is set to true any step related to remote staging will be skipped and just local staging volition be performed. The default setting is false .

skipLocalStaging

Whentruthful , bypass all staging specific features. Remote deploys happen inline at deploy phase of each module, not at build finish. The deployment repository is "sourced" frompom.xml <distributionManagement>. Which distribution repository is used depends on the project having a release or snapshot version. Substantially this selection makes the staging plugin execution human activity like the default maven-deploy-plugin. The default setting isfalse.

stagingProgressTimeoutMinutes

Defaulting to 5 minutes, this configuration allows you to set the timeout for staging operations. Changes are most often required for complex staging operations involving custom staging rules or Nexus IQ Server integration.

stagingProgressPauseDurationSeconds

The default of 3 seconds can be changed if larger pauses betwixt progress polls for staging operations are desired.

WithskipRemoteStaging is set totrue, merely the local staging happens. This local staging tin can then be picked upwards for the remote staging and closing by running the deploy-staged goal of the plugin explicitly similar this:

mvn nexus-staging:deploy-staged

Likewise the defaultdeploy goal the Nexus Staging Maven plugin supports a number of additional goals. By configuring executions of the goals as role of your POM or manually invoking them further automation of a staged release process can exist achieved.

deploy-staged

Perform total staging deployment workflow for a locally staged project, e.g., with the components intarget/nexus-staging.

deploy-staged-repository

Perform an upload of a repository from the local filesystem to a staging repository.

close

Shut the staging repository for current context.

drop

Drop the staging repository for current context.

release

Release the staging repository for electric current context.

promote

Promote the staging repository for the current context.

Closing, dropping, and releasing the staging repository using the goals relies on content of a local staging binder .

Promoting additionally needs the build promotion profile proper name passed in via thebuildPromotionProfileId configuration parameter.

Thedeploy-staged-repository goal can be used to phase a repository. Typically, a local repository is created with an invocation of the deploy similar to:

mvn deploy -DaltDeploymentRepository=local::default::file://path

To deploy this file system repository with the goal, you have to provide the path to this repository with therepositoryDirectory parameter as well asnexusUrl,serverId andstagingProfileId. Optionally you can configure the repository to stage into with stagingRepositoryId . This aggregated command can then be run exterior whatsoever specific Maven project.

While the in a higher place goals demand the context of a projection with configuration for the Nexus Staging Plugin in the POM file, it is possible to execute staging repository-related tasks without a project also. The Nexus Staging Maven plugin offers remote-control goals to command staging:

rc-close

Close a specified staging repository.

rc-drib

Drop a specified staging repository.

rc-release

Release a specified staging repository.

rc-promote

Promote a specified staging repository.

rc-list

List all staging repositories.

When invoking these goals outside a project context, you need to accept the Nexus Staging Maven plugingroupId specified equally apluginGroup in yoursettings.xml:

<pluginGroups>   <pluginGroup>org.sonatype.plugins</pluginGroup> </pluginGroups>

In improver, you lot need to specify all parameters on the command line every bit properties passed in via-Dkey=value.

At a minimum the required parametersserverId andnexusUrl have to exist specified:

mvn nexus-staging:rc-shut -DserverId=nexus - DnexusUrl=http://localhost:8081/nexus

Depending on the goal you lot will have to configure the staging repositories you want to close, drop or release with:

-DstagingRepositoryId=repo-001,repo-002

Also, you may supply a description like this:

-DstagingDescription="Dropping since QA of upshot 123 failed"

For promoting, you demand to add the required parameter that specifies the build promotion contour identifier:

-DbuildPromotionProfileId=12a25eabf8c8b3f2

A successful remote control drop would be logged in the control line similar to this:

— nexus-staging-maven-plugin:ane.2:rc-drop (default-cli) @ standalone-pom — [INFO] Connecting to Nexus... [INFO] Using server credentials with ID="nexus-releases" from Maven settings. [INFO] RC-Dropping staging repository with IDs=[test-003] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------

An example usage of therc-list goal with output is:

$mvn nexus-staging:rc-listing -DnexusUrl=http://localhost:8081/nexus -DserverId=nexus ... [INFO] --- nexus-staging-maven-plugin:one.5.1:rc-list (default-cli) @ standalone-pom --- [INFO] Connecting to Nexus... [INFO] Using server credentials with ID="nexus" from Maven settings. [INFO] Getting list of available staging repositories... [INFO] [INFO] ID Country Clarification [INFO] example_release_profile-thousand Open up Implicitly created (auto staging). ...

The Nexus Maven plugin in versions earlier than 2.one.0 had goals to piece of work with staging repositories. These goals accept been deprecated in favor of the remote command goals of the Nexus Staging Maven plugin.

Deployment with the Nexus Staging Ant Tasks

The Nexus Staging Ant tasks provide equivalent features to the Nexus Staging Maven plugin for Apache Emmet users roofing all use cases for interacting with the staging suite.

Historically Emmet builds typically have components that are required for the build, statically managed in the version command organization or even outside the project workspace birthday. More mod Ant builds use Apache Ivy or Eclipse Aether for resolving dependencies dynamically too as deployment build outputs to a repository manager. Examples projects setups using Ivy as well as Aether can be found in the documentation examples project . This projection includes examples for integration with the Nexus Staging Ant tasks.

To employ the Ant tasks in your Emmet build file, download the consummate JAR with the included dependencies from the Central Repository. Just search for nexus-staging-ant-tasks  and download the JAR file with the uber classifier e.grand.,nexus-staging-ant-tasks-1.6-ii-uber.jar.

After downloading, put the JAR file somewhere in your project or in your system so y'all can add information technology to the classpath in your build file with a chore definition. In the following instance, the JAR file is placed in a tasks folder within the project:

<taskdef uri="antlib:org.sonatype.nexus.pismire.staging"          resource="org/sonatype/nexus/ant/staging/antlib.xml">   <classpath>      <fileset dir="tasks" includes="nexus-staging-emmet-tasks-*uber.jar" />   </classpath> </taskdef>

To enable the tasks in your build file using a shortcut for the namespace, e.one thousand.,staging, you have to add information technology to the project node:

<project xmlns:staging="antlib:org.sonatype.nexus.ant.staging" ...>

The deployment-related information for your projection is captured in anexusStagingInfo section in your build file that contains all the necessary configuration:

<staging:nexusStagingInfo id="target-nexus"     stagingDirectory="target/local-staging">   <staging:projectInfo groupId="org.sonatype.nexus.ant"       artifactId="nexus-staging-ant-tasks"       version="1.0" />   <staging:connectionInfo       baseUrl="http://localhost:8081/nexus">     <staging:authentication       username="deployment"       password="deployment123" />   </staging:connectionInfo> </staging:nexusStagingInfo>

nexusStagingInfo:id

The identifier that allows you to reference the staging data in the Ant build file.

stagingInfo:stagingDirectory

The local staging directory, a identify where local staging will happen. Ensure that this directory is cleaned upwards past amake clean job or alike, if whatever.

projectInfo

The project information targeting a staging profile. This can be done explicitly with thestagingProfileId or implicitly with groupId, artifactId and version.stagingRepositoryId  tin also be role of projectInfo identifying a staging repository for interaction.

connectionInfo:baseUrl

The base URL of the repository manager y'all want to deploy to and interact with.

If necessary theconnectionInfo can have a nested proxy section:

<staging:proxy     host="proxy.mycorp.com"     port="8080">   <staging:authentication       username="proxyUser"       countersign="proxySecret" /> </staging:proxy>

With the higher up setup y'all are set to add together adeploy target to your build file that stages the components locally as well as remotely and closes the staging repository:

<target proper name="deploy" description="Deploy: Local and Remote Staging">   <staging:stageLocally>     <staging:nexusStagingInfo         refid="target-nexus" />       <fileset dir="target/local-repo"         includes="**/*.*" />     </staging:stageLocally>     <staging:stageRemotely>     <staging:nexusStagingInfo         refid="target-nexus" />   </staging:stageRemotely> </target>

The foldertarget/local-repo has to contain the components in a directory structure resembling the Maven repository format using thegroupId,artifactId, andversion coordinates of the component mapped to directory names. It will be merged into the target release repository, when the staging repository is released. An example on how to create such a structure in Ant can be found in the staging example for Apache Ivy and Eclipse Aether in the documentation examples project.

Similarly, you tin create a target that releases the staged components by adding thereleaseStagingRepository task to the terminate of the target:

<staging:releaseStagingRepository>   <staging:nexusStagingInfo       refid="target-nexus" /> </staging:releaseStagingRepository>

ThestageLocally chore takes a fileset as configuration. ThestageRemotely task has additional configuration options.

keepStagingRepositoryOnFailure

Fix totrue this causes the remote staging repository to be kept rather than deleted in instance of a failed upload. Default setting is false

skipStagingRepositoryClose

By default a staging repository is automatically closed, setting this parameter to true will cause the staging repository to remain open.

In addition to the tasks for local and remote staging, the Nexus Staging Emmet tasks include tasks for endmost, dropping, releasing and promoting a staging repository:

  • closeStagingRepository
  • dropStagingRepository
  • releaseStagingRepository
  • promoteStagingRepository

All these tasks take the context data from the local staging directory or from the optional parameterstagingRepositoryId. The job to promote a repository has the boosted, mandatory attributebuildPromotionProfileId to specify the build promotion profile to promote.

The timing of the job functioning can be affected by the following configuration parameters:

stagingProgressTimeoutMinutes

Defaulting to 5 minutes, this configuration allows you to set the timeout for staging operations. Changes are most often required for circuitous staging operations involving custom staging rules or Nexus IQ Server integration.

stagingProgressPauseDurationSeconds

The default of three seconds tin can be changed if larger pauses between progress polls for staging operations are desired.

Deployment with the Maven Deploy Plugin

When using the Maven Deploy plugin with the staging suite, you rely on implicit matching of the components confronting a staging profile based on a repository target definition.

To deploy a staged release, a developer needs to deploy to the staging URL. To configure a project to deploy to the staging URL, add thedistributionManagement element to your project's POM:

<projection xmlns="http://maven.apache.org/POM/four.0.0" ...   <distributionManagement>     <repository>       <id>nexus</id>       <name>Nexus Staging Repo</name>       <url>http://localhost:8081/nexus/service/local/staging/deploy/maven2/</url>     </repository>   </distributionManagement> ... </projection>

This configuration element,distributionManagement, defines therepository to which our deployment will exist made. It references the staging suite's URL:http://localhost:8081/nexus/service/local/staging/deploy/maven2

This URL acts equally a virtual repository to be published to. If a component beingness published matches one of the repository targets in a staging profile, that staging profile is activated and a temporary staging repository is created.

Once the sample project'southwarddistributionManagement has been set to point at the staging URL and your deployment credentials are updated in your~/.m2/settings.xml file, you tin deploy to the staging URL. To do this, runmvn deploy:

$ mvn deploy [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Edifice staging-test [INFO] task-segment: [deploy] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resource] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nix to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resource. [INFO] [compiler:testCompile] [INFO] Nothing to compile - all classes are upwardly to date [INFO] [surefire:test] [INFO] Surefire report directory: /private/tmp/staging-test/target/surefire-reports ... [INFO] [jar:jar] [INFO] [install:install] [INFO] Installing /private/tmp/staging-exam/target/staging-exam-1.0.jar to \ ~/.m2/repository/com/sonatype/sample/staging-test/i.0/staging-examination-1.0.jar [INFO] [deploy:deploy] altDeploymentRepository = naught Uploading: http://localhost:8081/nexus/service/local/staging/deploy/maven2/\ com/sonatype/sample/staging-examination/1.0/staging-test-1.0.jar 2K uploaded [INFO] Uploading projection data for staging-test ane.0 [INFO] Retrieving previous metadata from nexus [INFO] repository metadata for: 'component com.sonatype.sample:staging-test' could not be found on repository: nexus, so volition be created [INFO] Uploading repository metadata for: 'component com.sonatype.sample:staging-test' [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL

If the staging suite is configured correctly, any deployment to the staging URL matching a repository target configured for a staging contour should be intercepted by the staging suite and placed in a temporary staging repository. Deployment with the Maven Deploy plugin will non automatically close the staging repository. Closing the staging repository has to be done via the user interface or the Nexus Staging Maven plugin. Once this repository has been airtight, it will exist made available in the target group you selected when you configured the staging profile.

Deployment and Staging with Gradle

The Gradle build system tin can be used to deploy components with the Gradle Maven plugin. The Nexus Staging Ant tasks can be used in Gradle allowing full integration of the staging suite features in a Gradle build.

An example projection showcasing this integration is available in the documentation examples project .

Manually Uploading a Staged Deployment

Y'all can also upload a staged deployment via the user interface. To upload a staged deployment, select Staging Upload from the main menu. Clicking Staging Upload volition prove the panel shown in Figure eleven.x, "Manually Uploading a Staged Deployment".

Figure eleven.10. Manually Uploading a Staged Deployment

To upload a component, click onSelect Artifact(south) for Upload… and select an components from the filesystem to upload. In one case you accept selected a component, you can modify the classifier and the extension before clicking on the Add Artifact button. Repeat this process to upload multiple components for the sameGrouping,Artifact andVersion (GAV) coordinates like a JAR, the POM and perhaps a sources and javadoc JAR in add-on. In one case you have added all the components, you can then configure the source of theGroup,Artifact,Version (GAV) parameters.

If the component yous are uploading is a JAR file that was created past Maven, it will already have POM information embedded in it, but if yous are uploading a JAR from a vendor you will likely demand to set theGroup Identifier,Artifact Identifier, andVersion manually. To practise this, select GAV Parameters from the GAV Definition driblet-down at the height of this course. Selecting GAV Parameters will expose a set of form fields that will allow yous set the Grouping, Artifact, Version, and Packaging of the components being uploaded. If you would prefer to set the Group, Antiquity, and Version identifiers from a POM file that was associated with the uploaded component, select From POM in the GAV Definition drop-down. Selecting From POM in this drib-downwards will expose a button labeledSelect POM to Upload . Once a POM file has been selected for upload, the name of the POM file will be displayed in the course field below this button.

The Staging Upload panel supports multiple components with the sameGrouping,Artifact, andVersion identifiers. For example, if you need to upload multiple components with different classifiers, you may practise so by clicking on Select Artifact(s) for Upload and Add together Artifact multiple times. This interface also accepts an Artifact Bundle which is a JAR that contains more than one component, which is documented in more particular in Artifact Bundles.

Once a staging component upload has been completely configured, click on Upload Artifact(s) button to brainstorm the upload process. The repository manager will upload the components to the Staging URL which will trigger whatsoever staging profiles that are activated by the upload by explicitly matching using the repository targets configured with the staging profiles. If a staging contour is activated, a new staging repository will be created and can be managed using the procedures outlined in Managing Staging Repositories.

calesbectim.blogspot.com

Source: https://help.sonatype.com/repomanager2/staging-releases/configuring-your-project-for-deployment

0 Response to "Mvn Deploy Adding Version to File Upload"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel