idea打包maven打包maven包

来源:互联网 发布:everything微课软件 编辑:程序博客网 时间:2024/05/20 06:41

一、maven默认jdk版本,pom.xml

  <properties>      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>      <java.version>1.8</java.version>  </properties></properties>

二、打包,pom.xml

<packaging>jar</packaging><build>    <plugins>        <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-compiler-plugin</artifactId>            <configuration>                <source>1.8</source>                <target>1.8</target>            </configuration>        </plugin>        <plugin>            <artifactId>maven-resources-plugin</artifactId>            <version>2.5</version>            <executions>                <execution>                    <id>copy-xmls</id>                    <phase>package</phase>                    <goals>                        <goal>copy-resources</goal>                    </goals>                    <configuration>                        <outputDirectory>${basedir}/target/classes</outputDirectory>                        <resources>                            <resource>                                <directory>${basedir}/src/main/resource</directory>                                <includes>                                    <include>**/*</include>                                </includes>                            </resource>                        </resources>                    </configuration>                </execution>            </executions>        </plugin>        <plugin>            <artifactId>maven-assembly-plugin</artifactId>            <configuration>                <appendAssemblyId>false</appendAssemblyId>                <descriptorRefs>                    <descriptorRef>jar-with-dependencies</descriptorRef>                </descriptorRefs>                <archive>                    <manifest>                        <mainClass>com.sample.http.ServerTest</mainClass>                    </manifest>                </archive>            </configuration>            <executions>                <execution>                    <id>make-assembly</id>                    <phase>package</phase>                    <goals>                        <goal>assembly</goal>                    </goals>                </execution>            </executions>        </plugin>    </plugins></build>

三、步骤
1.
这里写图片描述

2.
这里写图片描述

3.
这里写图片描述

4.run

原创粉丝点击