I'm very new to maven, so kindly bear with me.
i have a maven project with about 10 dependencies all of which are present in my local system. So I'm adding them to my classpath via pom.xml
with <scope>
being system
and <systemPath>
giving path to the said dependencies. A rough structure of my pom.xml looks like this:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>MAVEN_APP</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MAVEN_APP</name>
<properties>
<jdk.version>1.8</jdk.version>
</properties>
<dependencies>
<dependency>
<groupId>jar1</groupId>
<artifactId>dependency1</artifactId>
<version>0.9.5</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/Details/Lib/jar1Name.jar</systemPath>
</dependency>
......
<dependency>
<groupId>jar10</groupId>
<artifactId>dependency10</artifactId>
<version>0.9.5</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/Details/Lib/jar10Name.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.*</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources/Details</directory>
<excludes>
<exclude>*.*</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources/Details/config</directory>
<excludes>
<exclude>*.*</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
This includes all the jars into my classpath and everything is running fine.
But I would like to create a jar of my project with the jar containing only the source code(i.e., only the compiled java classes). It should not include any of the dependencies.
To do this I included the <plugins>
as shown above and executed mvn clean -X install
. But I notice that all the underlying dependencies are being included within the jar.
Could somebody help me here. Thanks in advance.