Howdy,

given there is no question (I did not find it?), I guess the above setup
does not work?

By your description, code should be ok (as you describe it), all you need
to ensure is that you have plexus metadata present (you also did not
specify which maven version you build against). The code should NOT be
built as a maven-plugin, but as a simple JAR w/ plexus-component-metadata
(if not already).

Next, to extend the resolver, you CANNOT do it via POM or extensions.xml
(to have that latter, GAV into a downloaded JAR file, the resolver is
already constructed).

Hence, put the JAR w/ Plexus Metadata into the $MAVEN_HOME/lib/ext
directory instead, as this would be an "early" loaded extension.

More about it here:
https://maven.apache.org/guides/mini/guide-using-extensions.html

HTH
T




On Tue, Feb 14, 2023 at 11:46 AM Stephane Passignat <passig...@hotmail.com>
wrote:

> Hello,
>
>
> I created a custom ArtifactRepositoryLayout to import libraries from a
> non standard repository layout. Now I would like maven to use it...
>
>
> The class is created like the default layout, with another id.
>
> @Component(role =ArtifactRepositoryLayout.class, hint ="http-directory")
>
> public String getId() {
>     return "http-directory";
> }
>
> To make sure I see the usage of this extension interface method print a
> stacktrace:
>
> public String pathOf(Artifact artifact) {
>     Thread.dumpStack();
>
> It's built as a plugin (only maven-bundle-plugin is new to me, I already
> made several plugins):
>
> <plugin>
>     <groupId>org.apache.felix</groupId>
>     <artifactId>maven-bundle-plugin</artifactId>
>     <extensions>true</extensions>
>     <configuration>
>
>     </configuration>
> </plugin>
> <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-plugin-plugin</artifactId>
>     <version>3.6.0</version>
>     <configuration>
>        <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
>     </configuration>
>     <executions>
>        <execution>
>           <id>mojo-descriptor</id>
>           <goals>
>              <goal>descriptor</goal>
>           </goals>
>        </execution>
>     </executions>
> </plugin>
>
> In the pom.xml of the project, I setup the repository with that layout:
>
> <layout>http-directory</layout>
>
> Then I registered an extension in a project (new to me) in order to have
> it in the classpath:
>
> .mvn/extensions.xml
>
> <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>...</groupId>
>        <artifactId>maven-http-directory</artifactId>
>        <version>1.0-SNAPSHOT</version>
>     </extension>
> </extensions>
>
>
> Thanks for your help.
> Stéphane
>

Reply via email to