3

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!

Salvatorelab
  • 11,614
  • 6
  • 53
  • 80
  • 1
    If you have your own repository how does Maven know about it? – khmarbaise Mar 15 '18 at 07:25
  • 1
    It is configured in my `~/.m2/settings.xml` as I said, with a `` list and a `` list too. It works for normal dependencies, but this is the first time I try to use it with an extension so maybe I need to add something for that? – Salvatorelab Mar 15 '18 at 08:23
  • @Salvatorelab Did you do `mvn install` on ur extension ? Can u pls provide the full log ? As far as I know, if artifact not found in remote , maven gets it from local repo only. – Number945 May 13 '19 at 10:18

1 Answers1

1

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>