Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6023099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:57:18+00:00 2026-05-23T03:57:18+00:00

I have a third party jar which is necessary for our project. It is

  • 0

I have a third party jar which is necessary for our project. It is not available on the central maven repository, so I used the maven-install-plugin to install the jar locally during a build. I tied the “install-file” goal to the “validate” phase, and this mostly works. The pom.xml file excerpt is below:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>install-myartifact</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <file>${basedir}/lib/myartifact-1.2.3.jar</file>
                        <groupId>com.example</groupId>
                        <artifactId>myartifact</artifactId>
                        <version>1.2.3</version>
                        <packaging>jar</packaging>
                        <generatePom>true</generatePom>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>com.example</groupId>
        <artifactId>myartifact</artifactId>
        <version>1.2.3</version>
    </dependency>
</dependencies>

However, there’s a catch. Most of our developers and our Jenkins installation run “mvn clean install.” The “validate” phase is not part of the “clean” lifecycle, and clean inexplicably requires all the dependencies be present to run. So the first time someone runs this build, it does not work.

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building MyModule
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\svn\trunk\mymodule\target
Downloading: http://nexusserver.local:8080/nexus/content/groups/public/com/example/myartifact-1.2.3.pom
[INFO] Unable to find resource 'com.example:myartifact:pom:1.2.3' in repository central (http://central)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.example:myartifact:jar:1.2.3

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.example -DartifactId=myartifact -Dversion=1.2.3 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.example -DartifactId=myartifact -Dversion=1.2.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) com.example:mymodule:war:0.0.1-SNAPSHOT
    2) com.example:myartifact:jar:1.2.3

----------
1 required artifact is missing.

for artifact: 
  com.example:mymodule:war:0.0.1-SNAPSHOT

from the specified remote repositories:
  nexus (http://nexusserver.local:8080/nexus/content/groups/public)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jun 09 11:01:24 EDT 2011
[INFO] Final Memory: 17M/247M
[INFO] ------------------------------------------------------------------------

If I were to run simply “mvn install”, the jar is installed during “validate,” and I can run “mvn clean install” in subsequent builds. However, our build server does not have that flexibility. I’ve considered the following:

  1. Moving the phase to “pre-clean,” but that assumes everyone always uses clean the first time. It wouldn’t help if someone ran simply “mvn install.”
  2. Copying the execution, with one occurring during “pre-clean” and one occurring during “validate.” This covers all the bases, but the copied code leaves a bad taste.

Ideally, I’d love some other option. Is it possible to run clean without dependencies? Or to run a plugin twice without having to fully copy the execution? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:57:18+00:00Added an answer on May 23, 2026 at 3:57 am

    It looks like you’re using nexus. It might be easier to deploy the artifact to the nexus repo as opposed to having to maintain it with this project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the third party jar's in my WEB project placed at /src/main/webapp/WEB-INF/lib/ I
I've got an Oracle 10g database, and I have a third-party jar file. I
I have a third-party product, a terminal emulator, which provides a DLL that can
I have a third-party library in my SVN repository and I'd like to associate
I have a third party jar that connects to a server and executes command
I have a third party .Net web application (Sitecore) which connects to an Oracle
I have a third party library that internally constructs and uses the SqlConnection class.
I have a third-party app that creates HTML-based reports that I need to display.
I have a third party .NET Assembly and a large Java application. I need
I have an third-party applet that requires JRE v1.5_12 to work correctly. THe user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.