0

There are multiple jars (10 jars) and I have to use them in classpath in maven project. These jars are available in my Project-dir/lib folder.

To handle this I tried

<build>         
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <additionalClasspathElements>
                        <additionalClasspathElement>lib/*.jar</additionalClasspathElement>
                    </additionalClasspathElements>
                </configuration>
            </plugin>
        </plugins>
</build>

changed lib/*.jar to 1. lib 2. /lib etc but nothing seems working

Also tried

<repositories>
        <repository>
            <id>in-project</id>
            <name>In Project Repo</name>
            <url>lib/*.jar</url>
        </repository>
    </repositories>

But always faced error (cannot find symbol) on running mvn install

RArora
  • 234
  • 1
  • 7

1 Answers1

0

If you want to use jars as dependencies for build or test, they should be inside a Maven repository (not in a lib folder in your project).

The best thing would be to upload them to your company Nexus/Artifactory (if they are not already available from MavenCentral or some other remote Maven repository).

Alternatively, you can use mvn install:install-file to install them to the local repository on your computer.

After that, you can reference them in the pom.xml as dependencies.

Also see: How to add local jar files to a Maven project?

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142