• maven 打包197


       <build>
            <finalName>ds-module-tool</finalName>
            <sourceDirectory>src/main/java</sourceDirectory>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/*</include>
                    </includes>
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
          <!-- 打包可执行jar --> <!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin>-->

            <!-- 打包普通jar 可以让别的依赖的 --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <!--这部分可有可无,加上的话则直接生成可运行jar包--> <!--<archive>--> <!--<manifest>--> <!--<mainClass>${exec.mainClass}</mainClass>--> <!--</manifest>--> <!--</archive>--> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build>

    如何将多个模块打成一个服务???

    1.将需要用到的模块打成普通jar

    2. 新建一个模块,将那些普通jar引入到此模块下

    3. 将新模块打包成可执行的jar即可

       多模块单服务启动的pom配置如下

     <build>
            <finalName>ds-module-jar</finalName>
            <sourceDirectory>src/main/java</sourceDirectory>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/*</include>
                    </includes>
                    <!--<excludes>
                        <exclude>**/*.yml</exclude>
                    </excludes>-->
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <!--使用jdk1.8-->
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <mainClass>com.ds.jar.Application</mainClass>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    

      

  • 相关阅读:
    CCF NOI1062 计算曼哈顿距离
    CCF NOI1061 Wifi密码
    CCF NOI1073 放苹果
    CCF NOI1072 爬楼梯
    CCF NOI1071 Pell数列
    CCF NOI1064 计算斐波那契第n项
    NOI训练行动路线图
    CCF NOI1060 雷同检测
    CCF NOI1059 表达式求值
    CCF NOI1057 石头剪刀布
  • 原文地址:https://www.cnblogs.com/Ai-Hen-Jiao-zhi/p/12049676.html
Copyright © 2020-2023  润新知