The easiest thing to build is an executable uper jar which contains all dependencies and can be used via: java -jar xxx.jar This can be archived with the maven-shade-plugin So your pom.xml would look like this: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven...
》》(2)maven-assembly-plugin插件中 默认情况下,maven-assembly-plugin内置了几个可以用的assembly descriptor: bin : 类似于默认打包,会将bin目录下的文件打到包中 jar-with-dependencies : 会将所有依赖都解压打包到生成物中【本次需求正好是将所有依赖也打包】 src :只将源码目录下的文件打包 project : 将整...
build配置项,mainClass为空因为不是可执行jar。 <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> </manifest> </archive> </configuration> <executions>...
1)If you want an uber-jar (repacked with all dependencies), look into using and configuring themaven-shade-plugin: <build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>1.6</version><executions><execution><phase>package</phase...
maven打可执行jar包的几种build写法,1、指定Main方法,依赖jar放进另一个文件夹中,并将该文件夹设为classpath<build><plugins><plugin><artifactId>maven-compiler-plugin</artifactId><configuration>1.8</sou
在pom中配置如下 <build><plugins><plugin><artifactId>maven-assembly-plugin</artifactId><configuration><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs><archive><manifest>package.Main</manifest></archive></configuration><executions><execution><id>make-assembly</id><phas...
在maven的依赖管理中,有两种方式可以对依赖关系进行,分别是可选依赖(Optional Dependencies)以及依赖排除...
添加以下代码后,运行mvn package命令将会创建一个包含依赖项的JAR文件: <project ...> <modelVersion>X.X.X</modelVersion> ... <licenses> ... </licenses> <properties> ... </properties> <dependencies> ... </dependencies> <build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugi...
-- 配置描述符文件 --><descriptor>src/main/assembly/assembly.xml</descriptor><!-- 也可以使用Maven预配置的描述符<descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs> --></configuration></plugin></plugins></build>...
参考maven打包指定名称并去除jar-with-dependencies后缀 在mavne中打包默认的一般为artifactId.{version}.${packageing},有些时候需要指定maven打包的名称,可以进行如下配置: 在pom.xml中build配配置中增加yourName,如果想去除jar-with-dependencies后缀,则在assembly配置中增加false...