Maven 使用笔记

导出依赖包

  • dependency:copy-dependencies-DoutputDirectory=D:\Work\Project\Project.UX\lib

Java 打包

<build>
    <finalName>ms-plugin-notify-nie</finalName>
    <plugins>

      <!--这个可以把包和依赖包, 打成一个 fat-jar-->
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <includeSystemScope>true</includeSystemScope>
        </configuration>
      </plugin>

      <!--这个将工程打成 jar 包-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathPrefix>dependencies/</classpathPrefix>
              <mainClass>org.gux.data.ms.plugin.notify.MsPluginNotifyNieApplication</mainClass>
              <useUniqueVersions>false</useUniqueVersions>
            </manifest>
          </archive>
          <outputDirectory>${project.build.directory}</outputDirectory>
        </configuration>
      </plugin>

      <!--这个取出依赖包-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source> <!-- depending on your project -->
          <target>1.8</target> <!-- depending on your project -->
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>

            <path>
              <groupId>org.mapstruct</groupId>
              <artifactId>mapstruct-processor</artifactId>
              <version>${mapstruct.version}</version>
            </path>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok-mapstruct-binding</artifactId>
              <version>0.2.0</version>
            </path>

          </annotationProcessorPaths>
        </configuration>
      </plugin>

    </plugins>
  </build>


KAMI
KAMI
数据挖掘研究员,专注分享数据领域的技术和业务,以及逻辑、思维和方法论

发表回复

文章结构
相关文章