6
votes

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!

1
Well, it is possible but not recommended. Why would you want to do this? - Andrew Logvinov
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
@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
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
then this article stackoverflow.com/questions/586202/… may help :) - wemu

1 Answers

3
votes

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.