| 1 |
---- |
| 2 |
Deploy an artifact with classifier |
| 3 |
------ |
| 4 |
Robert Scholte |
| 5 |
------ |
| 6 |
2013-09-01 |
| 7 |
------ |
| 8 |
|
| 9 |
~~ Licensed to the Apache Software Foundation (ASF) under one |
| 10 |
~~ or more contributor license agreements. See the NOTICE file |
| 11 |
~~ distributed with this work for additional information |
| 12 |
~~ regarding copyright ownership. The ASF licenses this file |
| 13 |
~~ to you under the Apache License, Version 2.0 (the |
| 14 |
~~ "License"); you may not use this file except in compliance |
| 15 |
~~ with the License. You may obtain a copy of the License at |
| 16 |
~~ |
| 17 |
~~ http://www.apache.org/licenses/LICENSE-2.0 |
| 18 |
~~ |
| 19 |
~~ Unless required by applicable law or agreed to in writing, |
| 20 |
~~ software distributed under the License is distributed on an |
| 21 |
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 |
~~ KIND, either express or implied. See the License for the |
| 23 |
~~ specific language governing permissions and limitations |
| 24 |
~~ under the License. |
| 25 |
|
| 26 |
~~ NOTE: For help with the syntax of this file, see: |
| 27 |
~~ http://maven.apache.org/doxia/references/apt-format.html |
| 28 |
|
| 29 |
Deploy an artifact with classifier |
| 30 |
|
| 31 |
Beside the main artifact there can be additional files which are attached to the Maven project. Such attached files can be recognized and accessed by their classifier. |
| 32 |
|
| 33 |
For example: from the following artifact names, the classifier is located between the version and extension name of the artifact. |
| 34 |
|
| 35 |
* <<<artifact-name-1.0.jar>>> the main jar which contains classes compiled without {{{https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#debug}debugging}} information (such as linenumbers) |
| 36 |
|
| 37 |
* <<<artifact-name-1.0-debug.jar>>> the classified jar which contains classes compiled with {{{https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#debug}debugging}} information, so will be larger |
| 38 |
|
| 39 |
* <<<artifact-name-1.0-site.pdf>>> a pdf which contains an export of the site documentation. |
| 40 |
|
| 41 |
[] |
| 42 |
|
| 43 |
You can deploy the main artifact and the classified artifacts in a single run. Let's assume the original filename for the documentation is <<<site.pdf>>>: |
| 44 |
|
| 45 |
+---+ |
| 46 |
mvn ${project.groupId}:${project.artifactId}:${project.version}:deploy-file -Durl=http://localhost:8081/repomanager/ \ |
| 47 |
-DrepositoryId=some.id \ |
| 48 |
-Dfile=path/to/artifact-name-1.0.jar \ |
| 49 |
-DpomFile=path-to-your-pom.xml \ |
| 50 |
-Dfiles=path/to/artifact-name-1.0-debug.jar,path/to/site.pdf \ |
| 51 |
-Dclassifiers=debug,site \ |
| 52 |
-Dtypes=jar,pdf |
| 53 |
+---+ |
| 54 |
|
| 55 |
If you only want to deploy the <<<debug>>>-jar and want to keep the classifier, you can execute the <<<deploy-file>>> like |
| 56 |
|
| 57 |
+---+ |
| 58 |
mvn ${project.groupId}:${project.artifactId}:${project.version}:deploy-file -Durl=http://localhost:8081/repomanager/ \ |
| 59 |
-DrepositoryId=some.id \ |
| 60 |
-Dfile=path-to-your-artifact-jar \ |
| 61 |
-DpomFile=path-to-your-pom.xml \ |
| 62 |
-Dclassifier=bin |
| 63 |
+---+ |
| 64 |
|
| 65 |
<<Note>>: By using the fully qualified path of a goal, you're ensured to be using the preferred version of the maven-deploy-plugin. When using <<<mvn deploy:deploy-file>>> |
| 66 |
its version depends on its specification in the pom or the version of Apache Maven. |