zoukankan      html  css  js  c++  java
  • Maven父子结构的项目依赖使用以及打包依赖

    1:在父子结构项目中,如果要是用其他模块的类。在当前项目中的pom中 加入 其他模块的配置

       <dependency>
          <groupId>com.spring.mySpring</groupId>
          <artifactId>mySpring-utils</artifactId>
          <version>0.0.1-SNAPSHOT</version>
        </dependency>

    其中的groupId与artifactId还有version要与对应的模块一致

    2:如果当前模块依赖其他模块,而且在打包的时候需要把依赖也打进去,则需要配置

    <build>
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <!-- 指定程序的主类 -->
                 <configuration>
                        <mainClass>org.mySpring.service.TestService</mainClass>
                 </configuration>
                 <executions>
                     <execution>
                         <goals>
                             <goal>repackage</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     
     </build>

    3:总的pom示例如下

    <?xml version="1.0"?>
    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <modelVersion>4.0.0</modelVersion>
      
      <parent>
        <groupId>com.spring.mySpring</groupId>
        <artifactId>mySpring-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      
      <artifactId>mySpring-service</artifactId>
      <name>mySpring-service</name>
      <url>http://maven.apache.org</url>
      
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
      
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        
        <!--  使用其他子模块的依赖  -->
        <dependency>
          <groupId>com.spring.mySpring</groupId>
          <artifactId>mySpring-utils</artifactId>
          <version>0.0.1-SNAPSHOT</version>
        </dependency>
      </dependencies>
      
      <!-- 打包的时候带其他的子模块 -->
     <build>
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <!-- 指定程序的主类 -->
                 <configuration>
                        <mainClass>org.mySpring.service.TestService</mainClass>
                 </configuration>
                 <executions>
                     <execution>
                         <goals>
                             <goal>repackage</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     
     </build>
    </project>
  • 相关阅读:
    iOS启动速度优化
    iOS Instruments工具使用
    iOS开发 AFN配置https请求
    git使用教程
    iOS之 接入新浪微博 SDK(微信支付) 的坑(registerApp 的问题)
    iOS之应用间跳转
    iOS设置iTunes文件共享
    IOS平台下抓包工具使用以及抓取API接口
    用CornerStone配置SVN,HTTP及svn简单使用说明
    iOS之取消键盘遮挡
  • 原文地址:https://www.cnblogs.com/zqzdong/p/11506633.html
Copyright © 2011-2022 走看看