maven maven-compiler-plugin无法下载

  • 在开发环境中,我配置好了自己的私服nexus, 里面阿里云,geo等等的资源库代理都写好了, 按理说只要连上我们的私服, 公共的jar包下载应该不是问题, 但是发现还是下载不了maven-compiler-plugin等等 的maven插件
    maven maven-compiler-plugin无法下载_第1张图片
  • 经过测试研究发现,maven的 pluginRepositories 属性没有配置, 如果不写pluginRepositories ,plugins还是走默认的maven仓库, repositories 和 pluginRepositories 都写好之后, 全部都会从私服下载了.
<distributionManagement>
        <repository>
            <id>SES Releasesid>
            <name>SES Releasesname>
            <url>http://192.168.168.198:2019/repository/ses-releasesurl>
        repository>
        <snapshotRepository>
            <id>SES Snapshotsid>
            <name>SES Snapshotsname>
            <url>http://192.168.168.198:2019/repository/ses-snapshotsurl>
        snapshotRepository>

    distributionManagement>

    <repositories>
        <repository>
            <id>SES_Repositoriesid>
            <name>SES_Repositoriesname>
            <url>http://192.168.168.198:2019/repository/ses/url>
            <releases>
                <enabled>trueenabled>
            releases>
            <snapshots>
                <enabled>trueenabled>
                <updatePolicy>alwaysupdatePolicy>
            snapshots>
        repository>
        
        
    repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>SES_Plugin_Repositoriesid>
            <name>SES_Plugin_Repositoriesname>
            <url>http://192.168.168.198:2019/repository/ses/url>
            <releases>
                <enabled>trueenabled>
            releases>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        pluginRepository>
    pluginRepositories>
  • 需要注意的一点maven setting.xml 配置文件中 mirror这个配置
<mirror>
  <id>aliyunmavenid>
  <mirrorOf>*mirrorOf>
  <name>阿里云公共仓库name>
  <url>https://maven.aliyun.com/repository/publicurl>
mirror>

注意maven下载的流程

  1. 找pom的repository, 确定远程仓库地址
  2. 找到settings.xml文件, mirror这个配置, mirror相当于一个拦截器, 按照上面的写法, 所有的jar请求都转到aliyun去了,就不会再去私服下载了,
  • 所以要注意mirror这一点, 所有的请求代理都应该在nexus私服创建好, 不要让mirror 把请求带跑偏了.开发人员打开项目就行,不需要自己再配置mirror.

你可能感兴趣的:(java,maven,java,开发语言)