2

I've created a Maven project with some dependencies on libraries (.jar files) which are not in Maven central. The internal repository that we had is being taken offline and we have not been authorized to make a new one, so I modified the POM to use install:install-file on each of those files when a certain profile is activated. It seemed to work on my machine, but it's possible it might not have worked because the .jars were already in my repository.

We had a new employee start this week and I was trying to help him install the dependencies by triggering the profile, and although the debug trace lists those goals as being on the plan (and mvn help:active-profiles shows the profile being activated), it doesn't work. The directories are created in the repository, but only a .lastupdated file for the .jar and the .pom are created.

The error we get is that POM could not be found for the given artifact. That's expected since we use <generatePom>true</generatePom> in the plugin's execution.

Any ideas on why this might not work?

Here's the relevant section of the POM:

  <profiles>
    <profile>
        <id>self-contained</id>
        <activation>
            <property>
                <name>installBundledJars</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.3.1</version>
                    <executions>
                        <execution>
                            <id>installCaseControlUpdateAPI</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>install-file</goal>
                            </goals>
                            <configuration>
                                <file>${basedir}/lib/CaseControlUpdateAPI.jar</file>
                                <groupId>com.west.thomson.contech</groupId>
                                <artifactId>CaseControlUpdateAPI</artifactId>
                                <version>1.0</version>
                                <packaging>jar</packaging>
                                <generatePom>true</generatePom>
                            </configuration>
                        </execution>
                        <execution>
                            <id>installMQ</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>install-file</goal>
                            </goals>
                            <configuration>
                                <file>${basedir}/lib/com.ibm.mq-5.304.jar</file>
                                <groupId>com.ibm</groupId>
                                <artifactId>mq</artifactId>
                                <version>5.304</version>
                                <packaging>jar</packaging>
                                <generatePom>true</generatePom>
                            </configuration>
                        </execution>
                        <execution>
                            <id>installMQJMS</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>install-file</goal>
                            </goals>
                            <configuration>
                                <file>${basedir}/lib/com.ibm.mqjms-5.304.jar</file>
                                <groupId>com.ibm</groupId>
                                <artifactId>mqjms</artifactId>
                                <version>5.304</version>
                                <packaging>jar</packaging>
                                <generatePom>true</generatePom>
                            </configuration>
                        </execution>
                        <execution>
                            <id>installJADABAS</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>install-file</goal>
                            </goals>
                            <configuration>
                                <file>${basedir}/lib/jadabas.jar</file>
                                <groupId>com.softwareag</groupId>
                                <artifactId>jadabas</artifactId>
                                <version>1.0</version>
                                <packaging>jar</packaging>
                                <generatePom>true</generatePom>
                            </configuration>
                        </execution>
                        <execution>
                            <id>installOJDBC</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>install-file</goal>
                            </goals>
                            <configuration>
                                <file>${basedir}/lib/ojdbc14.jar</file>
                                <groupId>oracle</groupId>
                                <artifactId>ojdbc14</artifactId>
                                <version>10g</version>
                                <packaging>jar</packaging>
                                <generatePom>true</generatePom>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
  </profiles>
Platinum Azure
  • 45,269
  • 12
  • 110
  • 134
  • You can rename your local repository and retest the install to see if it works, but you need a remote repository to download the maven plugins etc. Furthermore if you remote repository has been taken offline you can't work and you have to tell your management/boss whoevery is responsible for that it should be changed. It doesn't make sense to work in that way. – khmarbaise Sep 19 '12 at 14:37
  • Sorry, I should have been more clear. We use maven central for most of our plugins and that works fine. This project was created knowing that the internal repository was coming offline, so we did not specify it in our POM at all (and that's fully intentional). We're trying to use `install:install-file` as a workaround, since we do have the .jar files available. – Platinum Azure Sep 19 '12 at 14:45
  • The simplest solution would be to setup a repo manager like Nexus, Artifactory or whatever to remove such problems at all. But this does of course not answer your question. – khmarbaise Sep 19 '12 at 17:37
  • My suggestion was to rename the current local repository and start from scratch to test the build (install-file with the above pom). If it works correct you can move this to your colleague. – khmarbaise Sep 19 '12 at 17:38
  • try running the mvn install:install-file from command line, does this work? Try activating the profile on every run putting the _true_ tags to the _activation_ section. Does that help? – Marek Dec Sep 19 '12 at 21:10
  • `true` did not work. Running `mvn install:install-file` worked. Any idea why it wouldn't work in the POM but work on the command line? – Platinum Azure Sep 19 '12 at 21:17
  • Can you post the maven logs? What goal are you running other than `install:install-file`? – kewne Jun 22 '17 at 11:04
  • 1
    Did you ever resolve this issue? Was the resolution to stop using it? – Shammoo Dec 13 '17 at 19:17

1 Answers1

0

Two possible problems i can think of, - check if you have the libs in the specified path. - check permissions on the .m2 repo and the project location where you are running mvn cmd.

Palani
  • 1
  • 1