Hi Tamas,
thanks a lot for understanding the question. It would be easier to have
such extension/plugin declared in a setting file, as it would help to
keep the project portable, but it works well.
The solution to create a custom artefact loader is an implementation of
RepositoryLayoutFactory with the layout as @Named.
@Named("http-directory")
public final class HttpDirectoryFactory implements RepositoryLayoutFactory
<repository>
<id>exygen</id>
<url>http://www.exygen.fr/releases/</url>
<layout>http-directory</layout>
</repository>
The ArtifactRepositoryLayout seems useless.
regards,
Stephane
Le 2023-02-14 à 20:11, Tamás Cservenák a écrit :
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>
<!-- seehttp://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
--
*Stéphane Passignat*
✆ +33 6 62 57 47 86 <tel:+33662574786>
✉ passig...@hotmail.com
📍 3 place Jacques Marette, 75015 PARIS
<https://goo.gl/maps/LuevHLq14baW8xNP6>