7

I have a project with two modules: client and server. In the parent pom.xml I added info for the deployment phase, so as to deploy to a local directory:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.my</groupId>
  <artifactId>myTest</artifactId>
  <version>0.1</version>
  <packaging>pom</packaging>
  <name>myTest</name>
  <modules>
    <module>server</module>
    <module>client</module>
  </modules>

<!-- for: mvn deploy -->
<distributionManagement>
    <repository> 
        <id> myRepo </id>
        <url> file:myDeployDir </url>
    </repository>
</distributionManagement>

</project>

When I run mvn deploy not only server-0.1.jar and client-0.1.jar get copied to myDeploy but a sum of 33 (!) files: *pom *sha1 *md5 *xml for pom, metadata and jar.

How can I set that only server-0.1.jar and client-0.1.jar should be copied?

Thanks!

cibercitizen1
  • 20,944
  • 16
  • 72
  • 95
  • Well, it is possible but not recommended. Why would you want to do this? – Andrew Logvinov Jan 22 '13 at 12:49
  • You are deploying artifacts to a repository which means in Maven having the artifacts (.jar, .pom, .sha1, .md5 etc.). Furthermore i would recommend to use a repository manager instead of the file system. If you like having only the jar's you need to do it in a different way. – khmarbaise Jan 22 '13 at 13:02
  • @AndrewLogvinov Perhaps I'm misunderstanding what the "deploy" phase actually means. I think that deploy is to put the final artifact (only the .jar) into the place where it is going to be used by the end user. I.E. if I develop a new unix command, then by deploying it, I understand to copy *only* the executable to (say) /usr/local/bin – cibercitizen1 Jan 22 '13 at 14:33
  • 1
    if you only want to copy some artifacts to file:myDeployDir then the assembly plugin may be an option for you. It is also used to bundle deliverables. Or is file:myDeployDir some Tomcat/webapps folder and you try to deploy the application? – wemu Jan 22 '13 at 15:02
  • @wemu No, it is only to copy the file, but I thought that "deploy" may be just copy in certain cases, while in other do more complicated things. It is not a webapp, I guess there is a standard pluging for deploying webapps. Thanks – cibercitizen1 Jan 22 '13 at 15:43
  • 1
    then this article http://stackoverflow.com/questions/586202/best-practices-for-copying-files-with-maven may help :) – wemu Jan 22 '13 at 15:51

1 Answers1

3

Use maven deploy-file

deploy:deploy-file is used to install a single artifact along with its pom. In that case the artifact information can be taken from an optionally specified pomFile, but can be completed/overriden using the command line.

gammay
  • 5,957
  • 7
  • 32
  • 51