首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven下载了一个特定的版本,我如何强制下载另一个版本?

Maven下载了一个特定的版本,我如何强制下载另一个版本?
EN

Stack Overflow用户
提问于 2020-02-19 09:19:43
回答 2查看 465关注 0票数 0

我在为这个maven项目而挣扎。

例如,当我尝试清理或打包项目时,会出现如下错误

代码语言:javascript
复制
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5

我已经对此提出了一个问题,但我意识到,在我的maven存储库中,我没有2.5版本,只有2.4.1,然后maven到中央存储库查找该版本并抛出这个错误。

但是我不知道maven为什么要寻找这个2.5版本,我没有在pom.xml上声明它,所以我可以在上修改或强制maven看2.4.1版本?

此外,我需要说,这个错误发生在我的所有项目(都来自同一个领域)。

这是pom.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>dom.example.exampleframe</groupId>
        <artifactId>project-parent-exampleframe</artifactId>
        <version>0.0.11.c-SNAPSHOT</version>
    </parent>

    <groupId>dom.example.project</groupId>
    <artifactId>project</artifactId>
    <version>1.9.0-SNAPSHOT</version>
    <name>project</name>
    <packaging>pom</packaging>

    <description>Esquelet d'una aplicació BaseFrame</description>
    <url>http://pro-projectes.example.pro/projects/project</url>


    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <instrumentation>
                        <excludes>
                            <exclude>**/ejb/*.class</exclude>
                            <exclude>**/domain/*.class</exclude>
                            <exclude>**/services/*.class</exclude>
                            <exclude>**/*Exception.class</exclude>
                            <exclude>**/Constants*.class</exclude>
                            <exclude>**/IConstants*.class</exclude>
                        </excludes>
                        <ignores>
                            <ignore>.+logger\..+</ignore>
                        </ignores>
                    </instrumentation>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- Perfils -->
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ui</module>
                <module>citizen.ui</module>
                <module>ear</module>
            </modules>
        </profile>
        <profile>
            <id>citizen</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ui</module>
                <module>citizen.ui</module>
                <module>ear</module>
            </modules>
        </profile>
        <profile>
            <id>difuse</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <modules>
                <module>domain</module>
                <module>logic</module>
                <module>resources</module>
                <module>ejb</module>
                <module>ear</module>
            </modules>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <customBundle>${project.exampledir}/src/site/resources/project-info-report_ca.properties</customBundle>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>dependency-info</report>
                            <report>project-team</report>
                            <report>summary</report>
                            <report>scm</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.14.1</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- Només s'ha d'incloure-hi la definició -->
                    <excludePackageNames>dom.example.project.serveis.ejb;dom.example.project.serveis.impl;dom.example.project.ui</excludePackageNames>
                    <!-- No hem d'incloure-hi els arxius de test -->
                    <excludes>**/*Test.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <xmlPath>${exampledir}/src/site/changes.xml</xmlPath>
                    <issueLinkTemplatePerSystem>
                        <Redmine2><![CDATA[%URL%/issues/%ISSUE%]]></Redmine2>
                    </issueLinkTemplatePerSystem>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>cobertura</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <distributionManagement>
        <site>
            <id>mavendocs-example</id>
            <name>mavendocs.example.dom</name>
            <url>${example.url.mavendocs}</url>
        </site>
    </distributionManagement>

    <modules>
        <module>domain</module>
        <module>recources</module>
        <module>logic</module>
        <module>ejb</module>
        <module>ui</module>
        <module>citizen.ui</module>
        <module>ear</module>
        <module>test</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>dom.example.tip</groupId>
            <artifactId>tip.domain</artifactId>
            <version>1.7.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.sca</groupId>
            <artifactId>sca.domain</artifactId>
            <version>1.3.4-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gea</groupId>
            <artifactId>gea.domain</artifactId>
            <version>2.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>examplegd</groupId>
            <artifactId>examplegd.domain</artifactId>
            <version>1.2.0</version>
            <scope>provided</scope>
        </dependency>
        <!-- Dependències del servei de registre. -->
        <dependency>
            <groupId>dom.example.res</groupId>
            <artifactId>res.domain</artifactId>
            <version>1.14.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!-- Dependències del mòdul d'ASF. -->
        <dependency>
            <groupId>dom.example.exampleframe.modules.asf</groupId>
            <artifactId>bf-modul-asf</artifactId>
            <version>0.0.2-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.alerts</groupId>
            <artifactId>alerts.domain</artifactId>
            <version>0.0.3-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gmc</groupId>
            <artifactId>gmc.domain</artifactId>
            <version>1.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.gmc</groupId>
            <artifactId>gmc.recursos</artifactId>
            <version>1.5.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom.example.exampleframe</groupId>
            <artifactId>exampleframe-transicio</artifactId>
            <version>[0.12.,1.0)</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
EN

回答 2

Stack Overflow用户

发布于 2020-02-19 09:40:45

你调查孩子,调查父母

代码语言:javascript
复制
<parent>
    <groupId>dom.example.exampleframe</groupId>
    <artifactId>project-parent-exampleframe</artifactId>
    <version>0.0.11.c-SNAPSHOT</version>
</parent>
票数 0
EN

Stack Overflow用户

发布于 2020-02-19 09:43:05

这应该在您的pom文件中提到,无论是在您的子文件中,还是在您的父母或祖父母的poms中。您可以使用有效的POM目标查看整个POM结构。这就是目标- org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60296782

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档