目录
引入本地包
引入本地包
<dependencies>
<dependency>
<groupId>org.richard</groupId>
<artifactId>my-jar</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/my-jar.jar</systemPath>
</dependency>
</dependencies>
system scope引入的包,在使用jar-with-dependencies打包时将不会被包含,可以使用resources将本地包打进jar-with-dependencies
指定打包路径
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>xxx-jar-with-dependencies</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<targetPath>lib/</targetPath>
<directory>lib/</directory>
<includes>
<include>**/my-jar.jar</include>
</includes>
</resource>
</resources>
</build>
Class.forName("xxx.Driver")这种运行时检查的无法找到。