Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy a jar file with maven

Tags:

maven

pom.xml

ant

I'm trying to copy the .jar, created by Maven 3, to another location. Currently, I'm using Ant's copy task, but Maven simply doesn't copy the file.

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <phase>install</phase>
      <configuration>
        <tasks>
          <copy file="target/myfile.jar" tofile="D:/Bukkit/plugins/myfile.jar"/>
        </tasks>
      </configuration>
    </execution>
  </executions>
</plugin>
like image 850
dr0n3 Avatar asked May 31 '13 16:05

dr0n3


People also ask

Can Maven download JARs?

You can use Maven's Dependency Plugin to save a copy of all the libraries and JAR files used by your project. In this article we'll look at how to use Maven to download all of your Java project's dependencies, like libraries and frameworks, and save them into a specific folder.

How do I copy files from one directory to another in Maven?

Using the Copy Rename Maven Plugin The copy-rename-maven-plugin helps copying files or renaming files/directories during the Maven build lifecycle. Upon building the project, we'll see foo. txt in the target/destination-folder.

Where does Maven store jar files?

Maven's local repository is a directory on the local machine that stores all the project artifacts. When we execute a Maven build, Maven automatically downloads all the dependency jars into the local repository. Usually, this directory is named . m2.


1 Answers

        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <configuration>
                <tasks>
                    <copy file="target/myfile.jar" tofile="D:/Bukkit/plugins/myfile.jar"/>
                </tasks>
            </configuration>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
like image 89
wytten Avatar answered Sep 28 '22 05:09

wytten