maven相关

1、ojdbc无法获取

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
</dependency>
    
[ERROR] Failed to execute goal on project xx: Could not resolve dependencies for projectxxx:jar:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc14:jar:10.2.0.4.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]

因为Oracle使用的授权协议,Maven的中央库不被允许托管其artifacts,你可以去下载相应的软件包到本地,然后将安装目录中的JDBC jar包install到本地的Maven仓库,Maven命令:

mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle 
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar    

 其他方法可以查看---》 请点我

2、建立了父子模块的工程,子工程在进行package前面,需要先对父亲工程进行install操作,不然会提示说找不到相应的父亲工程的.pom文件,如后面截图:

3、<dependencyManagement>

4、dependency中scope含义

5、打包成war文件时,需要指定<build>元素中的<outputDirectory>为具体相应编译后的java文件和相关配置文件输出的目录,不然相应property配置文件不会复制最新的文件到打包的war中。

6、这个依赖在aliyun镜像中不存在,在maven的setting中增加了http://mvnrepository.com/这个仓库地址后问题解决;同时要指定下mirrorOf标签,<mirrorOf>central</mirrorOf>,这个是我对阿里云的mirrorOf设置;

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>1.5.3.RELEASE</version>
   <relativePath /> <!-- lookup parent from repository -->
</parent>


gradle相关

1、阿里云仓库设置

 



6、maven排除依赖的子包

  1. <project>
  2. <modelVersion>4.0.0</modelVersion>
  3. <groupId>sample.ProjectA</groupId>
  4. <artifactId>Project-A</artifactId>
  5. <version>1.0-SNAPSHOT</version>
  6. <packaging>jar</packaging>
  7. ...
  8. <dependencies>
  9. <dependency>
  10. <groupId>sample.ProjectB</groupId>
  11. <artifactId>Project-B</artifactId>
  12. <version>1.0-SNAPSHOT</version>
  13. <exclusions>
  14. <exclusion>
  15. <groupId>sample.ProjectD</groupId> <!-- Exclude Project-D from Project-B -->
  16. <artifactId>Project-D</artifactId>
  17. </exclusion>
  18. </exclusions>
  19. </dependency>
  20. </dependencies>
  21. </project>
posted @ 2019-04-24 11:29  zhucezmf  阅读(120)  评论(0编辑  收藏  举报