Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple install:install-file in a single pom.xml

(Please read at least this before answering: This is a temporary measure! No, we do not want to set up a local repository manager and manually run a script)

We have a legacy project with a few dependencies which we have a local copy of including source and javadoc, and which has been proven to work well in production, but which is not available in the same quality in Central. We want to use those jars we already have.

I have found that I can manually run a suitably complex mvn install:install-file command to get the artifacts injected in the repository of the local machine, but I would like to have it work as part of the normal maven build of our various modules.

Given I have an otherwise blank module containing multiple jars which each need to be inserted with an install:install-file how should I do this in my pom.xml to be fully conformant with the normal Maven build?

Or can I just attach multiple jars to be the output of the module and somehow attach javadoc and source too)?

(and, please, no suggestion about submitting to central or setting up a local repository manager. This is a temporary solution until we have an opportunity to upgrade to a newer version of the dependencies)

like image 275
Thorbjørn Ravn Andersen Avatar asked May 29 '12 15:05

Thorbjørn Ravn Andersen


People also ask

Can we have multiple pom xml files for a single Maven project?

Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.


1 Answers

I would imagine something like this would work (this will install it on every build):

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <executions>
                <execution>
                    <id>inst_1</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!-- config for file 1 -->
                    </configuration>
                </execution>
                <execution>
                    <id>inst_2</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <!-- config for file 2 -->
                    </configuration>
                </execution>
                <!-- execution file 3... -->
            </executions>
        </plugin>            
    </plugins>
</build>
like image 160
jtahlborn Avatar answered Oct 17 '22 21:10

jtahlborn