简体   繁体   中英

Failed to read extensions descriptor. Could not find artifact in central

I have created a maven extension , and now I am trying to use it without installing it locally. So I have deployed it to our own repository (not maven central yet) but for some reason maven is trying to download it from https://repo.maven.apache.org/maven2 and it fails, of course:

[WARNING] Failed to read extensions descriptor /home/my-user/git/my-project/.mvn/extensions.xml: Plugin com.blablablah:kompile-maven-extension:1.0 or one of its dependencies could not be resolved: Could not find artifact com.blablablah:kompile-maven-extension:jar:1.0 in central ( https://repo.maven.apache.org/maven2 )

How can I tell maven to download it from our repository instead?

My ~/.m2/settings.xml is configured with both <repositories> and <pluginRepositories> for snapshots and releases pointing to my repo and it works for all dependencies, but apparently not for this extension.

I haven't found anything useful on maven docs, as it seems extensions are still "too new".

My {project-root}/.mvn/extensions.xml looks like this:

<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
    <extension>
        <groupId>com.blablablah</groupId>
        <artifactId>kompile-maven-extension</artifactId>
        <version>1.0</version>
    </extension>
</extensions>

I haven't modified the project pom.xml .
I have been looking at the effective pom for the whole project and the central repository is there, of course, both as a normal repo and as a plugin repo for every module, but always as the last entry, after my own repos. I haven't found anything that could explain why maven is looking for my extension ONLY in maven central.

What am I missing?

Maven version is 3.3.9. I have tested it also on maven 3.5.0.

Thank you!

The only thing that worked for me was adding the repository to settings.xml and add it to the active profiles:

<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">

    <profiles>
        <profile>
            <id>tycho-stage</id>
            <repositories>
                <repository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>oss</id>
                    <url>https://oss.sonatype.org/content/repositories/orgeclipsetycho-1056</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>oss</id>
                    <url>https://oss.sonatype.org/content/repositories/orgeclipsetycho-1056</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

    <activeProfiles>
        <activeProfile>tycho-stage</activeProfile>
    </activeProfiles>
</settings>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM