首页 > maven使用插件报错

maven使用插件报错

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.0-bate-1</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <finalName>springmaven</finalName>
    </build>

上面是插件信息,下面是当运行mvn site时包的错误,本地仓库中我已经看到有maven-site-plugin插件的jar包存在了。

[ERROR] Plugin org.apache.maven.plugins:maven-site-plugin:3.0-bate-1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-site-plugin:jar:3.0-bate-1 in http://10.10.13.5:8081/artifactory/plugins-release 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]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException


更改了版本号就好了


mvn命令后面加上-U就好了


Maven默认会使用本地缓存的库来编译工程,对于上次下载失败的库,maven会在~/.m2/repository/ / / /目录下创建xxx.lastUpdated文件,一旦这个文件存在,那么在直到下一次nexus更新之前都不会更新这个依赖库。

解决办法:

删除~/.m2/repository/ / / /目录下的*.lastUpdated文件,然后再次运行mvn compile编译工程。

另外也有说可以修改~/.m2/settings.xml文件,将其中的仓库添加
<updatePolicy>always</updatePolicy>

来强制每次都更新依赖库,但这个方法我还没有试过,这里先记下,下次再碰到这个问题的时候再试试。

当然一定要确保你远程仓库有这个插件

【热门文章】
【热门文章】