java - Maven下载特定版本,如何强制下载其他版本?

标签 java maven

我正在努力处理这个 Maven 项目。

当我尝试清理或打包项目时,我收到这样的错误

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

<?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>

最佳答案

你查看子pom,查看父pom

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

关于java - Maven下载特定版本,如何强制下载其他版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60296782/

相关文章:

java - java swing 中的 jbutton(浏览 pc 文件夹)

maven - 如何找出 maven 正在使用哪个 settings.xml 文件

eclipse - 如何在 Eclipse IDE 中使用 Git 工作树?

java - 在Web应用程序中获取tomcat/glassfish使用的java路径的任何方法

java - JTable、Java 中的列标题名称

java - 验证路径变量大小

Java 元编程难题 : get all annotations that are themselves annotated by a given annotation A

maven - 具有Jenkinsfile和Docker最佳实践的多分支管道项目

java - Maven WebApp tomcat7系统属性

java - spring编译错误: cannot access ParameterizedTypeReference