0

I am using the Maven (2.2.1) install-plugin (2.5.2) to install third party dependencies not available in the repository.

When the dependency has both a jar and a pom, install-plugin reads the pom file and sets the packaging, groupId, artifactId, and version so I don't need to specify them:

<execution>
    <id>1</id>
    <phase>validate</phase>
    <goals>
        <goal>install-file</goal>
    </goals>
    <configuration>
        <file>si/odm/jrules-engine/8.5.1/jrules-engine-8.5.1.jar</file>
        <pomFile>si/odm/jrules-engine/8.5.1/jrules-engine-8.5.1.pom</pomFile>
    </configuration>
</execution>

However, when the dependency has only a pom file, it forces me to specify the packaging, groupId, etc. manually:

<execution>
    <id>2</id>
    <phase>validate</phase>
    <goals>
        <goal>install-file</goal>
    </goals>
    <configuration>
        <packaging>pom</packaging>
        <groupId>odm</groupId>
        <artifactId>jrules-otherthing</artifactId>
        <version>8.5.1</version>
        <file>si/odm/jrules-otherthing/8.5.1/jrules-otherthing-8.5.1.pom</file>
    </configuration>
</execution>

Is it possible to configure install-plugin to read the pom file when it is the only file being installed?

Being able to do this would make the configuration a great deal shorter and more readable.

I tried specifying the pom file in the <pomFile> element without a <file> element, but install-plugin insists that I must have a <file>. I assume this isn't currently possible, but I wanted to ask here in case I missed something.

Aurifier
  • 197
  • 2
  • 9
  • 1
    First stop using [Maven 2.2.1](http://maven.apache.org/maven-2.x-eol.html) second install this jar file into a repository manager and don't try to do this via life cycle. – khmarbaise Jul 14 '15 at 08:32
  • That's exactly what I told my supervisor we should do! Glad I'm not crazy for thinking so. ;) – Aurifier Jul 14 '15 at 12:12

1 Answers1

1

To follow on from others' comments, Here is how I used maven-install-plugin to install only a pom into my repo using Maven 3.6.1:

    <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.0.0-M1</version>
                <configuration>
                    <groupId>com.microservice</groupId>
                    <artifactId>parent</artifactId>
                    <version>${revision}</version>
                    <packaging>pom</packaging>
                    <file>pom.xml</file>
                </configuration>
                <executions>
                    <execution>
                        <id>install-pom</id>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <phase>install</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
flossie
  • 71
  • 4