Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven To copy jar file from local folder

Tags:

maven-2

seam

I am using seam to develop my application and running it on weblogic 10.1MP Using maven2 to build the application and did not find the jboss-seam-wls-compatible.jar file in any repository. In maven how I can copy this jar from my local folder to the target/WEB-INF/lib folder.

like image 324
user118802 Avatar asked Sep 09 '09 07:09

user118802


1 Answers

The right way to do this in Maven is to install it into a repository (remote or local).

However, there are circumstances that local repository is less preferable. For example, you run Maven on lots of machines and you don't want manually install it.

I just use the anti-pattern of checking JARs into version control in these rare cases. I don't even bother to install it to local repository because it adds another step and makes another copy of the JAR. I just use the JAR directly like this,

            <dependency>
                    <groupId>local</groupId>
                    <artifactId>homeless-jar</artifactId>
                    <version>1.0</version>
                    <scope>system</scope>
                    <systemPath>${basedir}/lib/homeless.jar
                    </systemPath>
            </dependency>

EDIT: The ${basedir} is defined by Maven. It's the base directory of the Maven project, where your pom.xml is. My example wasn't clear. See this one,

            <dependency>
                    <groupId>any-id</groupId>
                    <artifactId>any-name</artifactId>
                    <version>1.0</version>
                    <scope>system</scope>
                    <systemPath>${basedir}/src/main/lib/homeless.jar
                    </systemPath>
            </dependency>
like image 124
ZZ Coder Avatar answered Oct 23 '22 15:10

ZZ Coder