Search code examples
mavenmaven-3tycho

How do I deploy the results of a tycho p2 repository build to a place on the local file system or a locally maintained p2 repository


I have a working Tycho build that produces a working p2 repository. My current work flow is to manually drag and drop the results of this build from the project's target dir to the web server that hosts the p2 repository. The results of my tycho build look normal:

${projectBaseDir}/target/repository
     - features
          - com.my.product.feature.201111071414.jar
     - plugins
          - com.my.product.plugins
     - artifacts.jar
     - content.jar

So, what is the "industry standard" for taking the results of this build in the repository directory and placing them on a web server.

In this case, I am running the p2 repository's web server on the same machine that is running the build sever, so a simple copy to a directory command would work.

I've tried the maven-resources-plugin using the resources:copy-resources with no luck. I kept getting an error about the invalid output directory. I don't really feel like copy-resources is the way to go here, since the general purpose of that goal is to copy files to the target directory of your maven build, and not to copy files from the target directory of a maven build.

My task seems simple, and I realize there are a lot of options to copy files, but I'm looking for the "maven way" or better yet, "the tycho way" of doing this. If such a standard exists.

thanks, TW


Solution

  • You can achieve what you want with the antrun plugin. It lets you use ant tasks/targets (like copying files) to do things during a Maven build.

    I expect something like the following would work for you:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
            <execution>
            <id>configFix</id>
            <phase>package</phase>
            <configuration>
                <target name="configFix">
                    <copy file="${project.build.directory}/p2/some.file" todir="C:\My\Directory" overwrite="true">
                    </copy>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
            </execution>
        </executions>
    </plugin>