Can I add jars to Maven 2 build classpath without installing them?

Yes, you can add jars to the Maven build classpath without installing them. To do this, you can use the systemPath element in the dependency element in your pom.xml file.

The systemPath element specifies the path to the jar file on your local system. Maven will include the jar file in the classpath when building the project, but it will not install the jar file in the local repository.

Here is an example of how you can use the systemPath element to add a jar file to the Maven build classpath:

<dependency>
  <groupId>com.example</groupId>
  <artifactId>my-library</artifactId>
  <version>1.0</version>
  <scope>system</scope>
  <systemPath>${basedir}/lib/my-library.jar</systemPath>
</dependency>

This dependency element specifies a jar file called my-library.jar located in the lib directory relative to the project base directory. The scope element is set to system to indicate that the jar file is not available in the local repository.

Note that the systemPath element is only intended for use in cases where the jar file is not available in a public repository. It is generally recommended to use the dependency element to manage dependencies, rather than using the systemPath element.