Maven父子结构的项目依赖使用以及打包依赖

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

   
      com.spring.mySpring
      mySpring-utils
      0.0.1-SNAPSHOT
    

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

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


     
         
             org.springframework.boot
             spring-boot-maven-plugin
             
             
                    org.mySpring.service.TestService
             
             
                 
                     
                         repackage
                     
                 
             
         
     
 
 

3:总的pom示例如下


    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  4.0.0
  
  
    com.spring.mySpring
    mySpring-parent
    0.0.1-SNAPSHOT
  
  
  mySpring-service
  mySpring-service
  http://maven.apache.org
  
  
    UTF-8
  
  
  
    
      junit
      junit
      3.8.1
      test
    
    
    
    
      com.spring.mySpring
      mySpring-utils
      0.0.1-SNAPSHOT
    
  
  
  
 
     
         
             org.springframework.boot
             spring-boot-maven-plugin
             
             
                    org.mySpring.service.TestService
             
             
                 
                     
                         repackage
                     
                 
             
         
     
 
 

 

转载于:https://www.cnblogs.com/zqzdong/p/11506633.html

你可能感兴趣的:(java,开发工具)