Iaroslav Karandashev
Iaroslav Karandashev

Reputation: 574

How to copy simple file with Maven?

I am learning Maven and I have some doubts on how to use dependency:copy plugin. After reading documentation it is still not clear which outputDirectory should I use? And why there are two different ones?

Also I'll be happy to know how to define a simple file as an artifactItem?

<configuration>
    <artifactItems>
        <artifactItem>
            <!-- How to define here a simple file to copy it? -->
            <overWrite>true</overWrite>
            <outputDirectory>???</outputDirectory>
        </artifactItem>
    </artifactItems>
    <outputDirectory>???</outputDirectory>
    <overWriteReleases>false</overWriteReleases>
    <overWriteSnapshots>true</overWriteSnapshots>
</configuration>

Thank you in advance.

Upvotes: 0

Views: 130

Answers (1)

blackbuild
blackbuild

Reputation: 5174

The top level outputDirectory defines the output directory for all artifacts, it can be overriden for individual artifact items (see outputDirectory parameter)

So usually, you do not define output directories for specific artifact items. If you define neither ouput directory, the default will apply, which is ${project.build.directory}/dependency.

To your second question:

dependency:copy is for copying dependencies from an artifact repository to your project. You could upload your "file" to some artifact repository (Nexus, Artifactory), but I doubt that is what you want.

Upvotes: 1

Related Questions