关于maven打包时,没有将依赖包打进来的问题
开发了一个工具给第三方调用,采用maven父子模块的方式组织项目。打包后,发现缺少对应的class文件,导致无法使用。 maven打包时,默认不会将第三方依赖包打进来。可以在pom.xml中添加maven-assembly插件实现… 打出的包里 xxxx-with-dependencies.jar 就是包含依赖包的
<build> <plugins> <!-- Maven Assembly Plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4.1</version> <configuration> <!-- get all project dependencies --> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <!-- bind to the packaging phase --> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
上一篇:
92天倒计时,蓝桥杯省赛备赛攻略来啦~