maven 使用assembly打zip包
程序员文章站
2024-03-20 20:08:46
...
话不多说,直接路配置文件,外带怎么把scala代码打入jar包中
<?xml version="1.0" encoding="UTF-8"?>
<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>cn.jldata</groupId>
<artifactId>test</artifactId>
<!--打成jar最后的项目名称-->
<name>test</name>
<version>1.0</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/scala</directory>
<targetPath>${basedir}/target/classes/</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>*.properties</exclude>
<exclude>*.yml</exclude>
<exclude>*.xml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<skip>true</skip>
<forkMode>once</forkMode>
<excludes>
<exclude>**/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
引入的assembly.xml
<assembly>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<includes>
<!--只打需要的包进入lib依赖中-->
<include>com.alibaba:fastjson</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/bin</directory>
<outputDirectory>bin</outputDirectory>
</fileSet>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory>conf</outputDirectory>
<includes>
<include>*.properties</include>
<include>*.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>kyw.stream-${project.version}.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
最后生成的目录结构
上一篇: Django中session操作
推荐阅读
-
maven 打包时解压本地zip包到指定文件夹
-
maven 使用assembly打zip包
-
使用maven编译,且使用lib下的Jar包 博客分类: maven
-
maven安装jar文件到本地资源库,Maven使用deploy上传jar包到远程库 博客分类: Maven/Ant mavenmvninstalllocaldeploy
-
IDEA+Maven install打可运行jar包
-
maven打可执行jar包(配置文件在jar包外)
-
Maven设置使用自定义的jar包到自己本地仓库
-
Maven入门之使用Nexus搭建Maven私服及上传下载jar包
-
Maven入门之使用Nexus搭建Maven私服及上传下载jar包
-
Maven设置使用自定义的jar包到自己本地仓库