Reputation: 91969
What I am doing?
I have created a maven
project, where I bundle some external jars
project/pom.xml
/bin
/safebrowsing2_2.11-0.2.5.jar
/scala-http-client_2.11-1.0.jar
The libraries safebrowsing2_2.11-0.2.5.jar
and scala-http-client_2.11-1.0.jar
are bundled because they are not available in Nexus
and are custom jars needed for legacy purposes.
pom.xml
uses following plugins
to bundle them up in one jar
<plugins>
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.5</version>
<executions>
<execution>
<goals>
<goal>add-jars</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${basedir}/bin</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
When this build runs on Jenkins
it fails with following warnings
[WARNING] The POM for com.shn:project-safebrowsing2_2.11-0.2.5.jar:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.shn:project-scala-http-client_2.11-1.0.jar:jar:1.0-SNAPSHOT is missing, no dependency information available
and error is
[ERROR] Failed to execute goal on project project-installer: Could not resolve dependencies for project com.project-installer:war:0.19.0-SNAPSHOT: The following artifacts could not be resolved: com.shn:project-external-dependencies-safebrowsing2_2.11-0.2.5.jar:jar:1.0-SNAPSHOT, com.shn:project-scala-http-client_2.11-1.0.jar:jar:1.0-SNAPSHOT: Could not find artifact com.shn:project-safebrowsing2_2.11-0.2.5.jar:jar:1.0-SNAPSHOT in company (http://172.62.11.24:8080/nexus/content/groups/public) -> [Help 1]
16:17:03 [ERROR]
16:17:03 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
16:17:03 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
16:17:03 [ERROR]
16:17:03 [ERROR] For more information about the errors and possible solutions, please read the following articles:
16:17:03 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Question
Yes, I know that they do not have pom.xml
, but how do I let the build pass and generate artifact?
Upvotes: 2
Views: 14897
Reputation: 14762
Use the install-file
goal of Maven's Install Plugin:
... to install an externally created artifact into the local repository, along with its POM.
Use the deploy-file
goal of Maven's Deploy Plugin to:
install the artifact in the remote repository.
... rather than placing the artifacts in your project's directory.
Upvotes: 4