Would you not rather write a Maven plugin or extension for something
like that and hook it into the build process globally, so you can use it
when specifying `repository` or `pluginReporitory` entries in the POM
needing it? This does not seem to be something limited to certain
plugins, if I understand correctly.

Alexander Kriegisch
https://scrum-master.de


Stephane Passignat schrieb am 22.02.2023 um 11:27:
> Hello,
> 
> thank you everyone for these suggestions. Let's go back to my original 
> issue.
> 
> I need to add a library to maven classpath. The library I need is 
> another RepositoryLayoutFactory, to download artifact located is a 
> repository which is not yet supported by Maven. Actually it's a basic 
> HTTP server. (It could be an FTP server or a database accessed is JDBC...)
> 
> The library is made, it works (as well as I need), but to use it I need 
> to add it to maven/lib/ext which is not portable to other computer. So 
> I'm looking at alternatives. Surefire could be a candidate, or not...
> 
> 
> I hope this helps to understand.
> 
> regards,
> 
> 
> Stephane
> 
> 
> Le 2023-02-16 à 11:58, Olivier Lamy a écrit :
>> On Thu, 16 Feb 2023 at 20:52, Olivier Lamy<ol...@apache.org>  wrote:
>>> On Thu, 16 Feb 2023 at 20:07, Delany<delany.middle...@gmail.com>  wrote:
>>>> Hi Stephane,
>>>>
>>>> You can do like this
>>>>
>>>>          <plugin>
>>>>            <artifactId>maven-surefire-plugin</artifactId>
>>>>            <version>3.0.0-M9</version>
>>>>            <dependencies>
>>>>              <dependency>
>>>>                <groupId>org.apache.commons</groupId>
>>>>                <artifactId>commons-email</artifactId>
>>>>                <version>1.5</version>
>>>>              </dependency>
>>>>            </dependencies>
>>>>          </plugin>
>>> this will add dependencies to the surefire plugin itself.
>>> I guess Stephane wants to add to the jvm running the tests?
>>>
>>> additionalClasspathElement expect a full path to a directory or a file
>>> to be added to the classpath
>>>
>>> should work with something such but you need to assume commons-email
>>> has been resolved locally as a dependency.
>>> <additionalClasspathElement>${settings.localRepository}/org/apache/commons/commons-email/1.5/commons-email-1.5.jar</additionalClasspathElement>
>>>
>>> another solution is to use dependency:copy to copy the commons-email
>>> dependency somewhere in ./target and use this path (see
>>> https://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html)
>>>
>> a real example here :)
>> https://github.com/apache/maven-surefire/blob/master/surefire-providers/common-junit48/pom.xml
>>
>>> hth
>>> Olivier
>>>
>>>> On Thu, 16 Feb 2023 at 11:25, Stephane Passignat<passig...@hotmail.com>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> Is it possible to add a maven artifact as an additionalClasspathElement ?
>>>>>
>>>>> I tried this syntax, inspired by the exclusion mechanism, but it's not
>>>>> working.
>>>>>
>>>>> <build>
>>>>>      <plugins>
>>>>>         <plugin>
>>>>>            <groupId>org.apache.maven.plugins</groupId>
>>>>>            <artifactId>maven-surefire-plugin</artifactId>
>>>>>            <version>3.0.0-M9</version>
>>>>>            <configuration>
>>>>>               <additionalClasspathElements>
>>>>>
>>>>> <additionalClasspathElement>org.apache.commons:commons-email:1.5</additionalClasspathElement>
>>>>>               </additionalClasspathElements>
>>>>>            </configuration>
>>>>>         </plugin>
>>>>>      </plugins>
>>>>> </build>
>>>>>
>>>>>
>>>>> thank you
>>>>>
>>>>> Stéphane
>>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscr...@maven.apache.org
>> For additional commands, e-mail:users-h...@maven.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to