DarVar
DarVar

Reputation: 18124

Running maven plugins in a specific phase

Is it possible to run the maven-install-plugin in a specific phase.

I want to run the install plugin so that the ojdbc14.jar is available in my repo before it tries to check for dependencies.

My attempt below is to try set the process-resources phase but that doesn't work

<dependencies>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.1.0</version>            
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <file>${basedir}/resources/ojdbc14.jar</file>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc14</artifactId>
                <version>10.2.0.1.0</version>
                <packaging>jar</packaging>
            </configuration>
        </plugin>
    </plugins>
</build>

Upvotes: 0

Views: 376

Answers (2)

khmarbaise
khmarbaise

Reputation: 97359

Best solution to install the artifact manuall once into a repository manager and afterwards use the artifact as usual dependency.

Upvotes: 1

artbristol
artbristol

Reputation: 32397

This can only work if the jar is checked into your source repository. I advise against this as it leads to bloat (particularly with distributed SCM). If you insist, follow this answer https://stackoverflow.com/a/7623805/116509

I recommend installing a repository manager such as Nexus and installing any required libs there.

Upvotes: 0

Related Questions