You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Christoph Laeubrich <la...@googlemail.com> on 2017/10/12 14:28:42 UTC

Maven Plugin that provides alternative repository

Hi,

I'd like to create a plugin that gets notified if maven tries to
download an artifact but does not find it in any of its configured
repositories. Is this possible to archive by a maven plugin? If yes
what is the best starting point for this?

My own search for this have not revelead any usefull information
beside basic maven plugin tutorials that do not cover this specific
case.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Mikolaj Izdebski <mi...@redhat.com>.
On 10/19/2017 06:12 AM, Christoph Laeubrich wrote:
> So extensions for WorkspaceReader can't be used like described here[1]
> inside the pom.xml?
> Does that mean I have to put my extension in the maven classpath to
> make it work?

IIRC, it won't work from pom.xml, but should work from extensions.xml
(Maven 3.3+). It definitely works when you drop your extension JAR into
lib/ext/ directory.

> If I do tis, is it still possible to configure the Extension inside
> the pom or has it to be done by system-properties?

Dependency resolution must work before effective model (POM) is
constructed - to resolve <parent> references. So you must find another
way of configuring your extension.

> 
> [1]https://maven.apache.org/guides/mini/guide-using-extensions.html

> 
> 2017-10-17 9:00 GMT+02:00 Mikolaj Izdebski <mi...@redhat.com>:
>> On 10/16/2017 12:39 PM, Paul Hammant wrote:
>>>>
>>>> This should be possible by providing WorkspaceReader implementation -
>>>> @Component( role = WorkspaceReader.class, hint = "ide" )
>>>>
>>>> Note that Maven tries resolution from workspace *before* repositories -
>>>> workspace reader has priority lower than reactor, but higher than remote
>>>> repos known to Maven.
>>>
>>> WorkspaceReader functionality is or is not a thing that can be set in
>>> pom.xml files?
>>
>> When POM is parsed, workspace reader is already loaded, so it would be
>> too late. So it needs to be loaded by an extension.
>>
>>> Are there any examples in public that use WorkspaceReader in use to
>>> source a dep from outside of maven central (or the projects sibling
>>> modules)?
>>
>> Eclipse M2E is one example. Another one is XMvn, which uses workspace
>> reader to resolve dependencies from system repository (not in Maven format):
>>
>> https://github.com/fedora-java/xmvn/blob/master/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnWorkspaceReader.java
>>
>>>
>>> - Paul
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>
>> --
>> Mikolaj Izdebski
>> Software Engineer, Red Hat
>> IRC: mizdebsk
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

-- 
Mikolaj Izdebski
Software Engineer, Red Hat
IRC: mizdebsk

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Christoph Laeubrich <la...@googlemail.com>.
So extensions for WorkspaceReader can't be used like described here[1]
inside the pom.xml?
Does that mean I have to put my extension in the maven classpath to
make it work?

If I do tis, is it still possible to configure the Extension inside
the pom or has it to be done by system-properties?

[1]https://maven.apache.org/guides/mini/guide-using-extensions.html

2017-10-17 9:00 GMT+02:00 Mikolaj Izdebski <mi...@redhat.com>:
> On 10/16/2017 12:39 PM, Paul Hammant wrote:
>>>
>>> This should be possible by providing WorkspaceReader implementation -
>>> @Component( role = WorkspaceReader.class, hint = "ide" )
>>>
>>> Note that Maven tries resolution from workspace *before* repositories -
>>> workspace reader has priority lower than reactor, but higher than remote
>>> repos known to Maven.
>>
>> WorkspaceReader functionality is or is not a thing that can be set in
>> pom.xml files?
>
> When POM is parsed, workspace reader is already loaded, so it would be
> too late. So it needs to be loaded by an extension.
>
>> Are there any examples in public that use WorkspaceReader in use to
>> source a dep from outside of maven central (or the projects sibling
>> modules)?
>
> Eclipse M2E is one example. Another one is XMvn, which uses workspace
> reader to resolve dependencies from system repository (not in Maven format):
>
> https://github.com/fedora-java/xmvn/blob/master/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnWorkspaceReader.java
>
>>
>> - Paul
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> --
> Mikolaj Izdebski
> Software Engineer, Red Hat
> IRC: mizdebsk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Mikolaj Izdebski <mi...@redhat.com>.
On 10/16/2017 12:39 PM, Paul Hammant wrote:
>>
>> This should be possible by providing WorkspaceReader implementation -
>> @Component( role = WorkspaceReader.class, hint = "ide" )
>>
>> Note that Maven tries resolution from workspace *before* repositories -
>> workspace reader has priority lower than reactor, but higher than remote
>> repos known to Maven.
> 
> WorkspaceReader functionality is or is not a thing that can be set in
> pom.xml files?

When POM is parsed, workspace reader is already loaded, so it would be
too late. So it needs to be loaded by an extension.

> Are there any examples in public that use WorkspaceReader in use to
> source a dep from outside of maven central (or the projects sibling
> modules)?

Eclipse M2E is one example. Another one is XMvn, which uses workspace
reader to resolve dependencies from system repository (not in Maven format):

https://github.com/fedora-java/xmvn/blob/master/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnWorkspaceReader.java

> 
> - Paul
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

-- 
Mikolaj Izdebski
Software Engineer, Red Hat
IRC: mizdebsk

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Manfred Moser <ma...@simpligility.com>.
I think this would modify the overall Maven behaviour and you would therefore have to implement this as an extension rather than as a plugin. Fyi. we have such an extension that modifies usage of the local repository already within Takari.

Use it as inspiration.. 

https://github.com/takari/takari-local-repository

Manfred

Paul Hammant wrote on 2017-10-16 03:39:

>>
>> This should be possible by providing WorkspaceReader implementation -
>> @Component( role = WorkspaceReader.class, hint = "ide" )
>>
>> Note that Maven tries resolution from workspace *before* repositories -
>> workspace reader has priority lower than reactor, but higher than remote
>> repos known to Maven.
> 
> WorkspaceReader functionality is or is not a thing that can be set in
> pom.xml files?
> 
> Are there any examples in public that use WorkspaceReader in use to
> source a dep from outside of maven central (or the projects sibling
> modules)?
> 
> - Paul
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Paul Hammant <pa...@hammant.org>.
>
> This should be possible by providing WorkspaceReader implementation -
> @Component( role = WorkspaceReader.class, hint = "ide" )
>
> Note that Maven tries resolution from workspace *before* repositories -
> workspace reader has priority lower than reactor, but higher than remote
> repos known to Maven.

WorkspaceReader functionality is or is not a thing that can be set in
pom.xml files?

Are there any examples in public that use WorkspaceReader in use to
source a dep from outside of maven central (or the projects sibling
modules)?

- Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Mikolaj Izdebski <mi...@redhat.com>.
On 10/16/2017 06:42 AM, Christoph Laeubrich wrote:
> Hi,
> 
> thanks for your reply. I'd like to make artifacts avaiable to maven
> via <dependency> that are located in a repository with a format that
> maven does not understand.
> Even though if I would have the group+artifactid+version I can locate
> that artifact there.
> So the idea is to add a plugin to the build that gets asked whenever
> maven does not find an artifact in any of its default sources so I can
> give it a try to find it in my special repro.

This should be possible by providing WorkspaceReader implementation -
@Component( role = WorkspaceReader.class, hint = "ide" )

Note that Maven tries resolution from workspace *before* repositories -
workspace reader has priority lower than reactor, but higher than remote
repos known to Maven.

-- 
Mikolaj Izdebski
Software Engineer, Red Hat
IRC: mizdebsk

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Christoph Laeubrich <la...@googlemail.com>.
Hi,

thanks for your reply. I'd like to make artifacts avaiable to maven
via <dependency> that are located in a repository with a format that
maven does not understand.
Even though if I would have the group+artifactid+version I can locate
that artifact there.
So the idea is to add a plugin to the build that gets asked whenever
maven does not find an artifact in any of its default sources so I can
give it a try to find it in my special repro.

Even though it might be possible to convert the other repro to a maven
structure, this means I have to download all artifacts from this,
upload them again and repeat the stepp an each change, thats why I'd
like to find a way to use the repro directly.

2017-10-12 18:48 GMT+02:00 Karl Heinz Marbaise <kh...@gmx.de>:
> Hi,
>
> On 12/10/17 16:28, Christoph Laeubrich wrote:
>>
>> Hi,
>>
>> I'd like to create a plugin that gets notified if maven tries to
>> download an artifact but does not find it in any of its configured
>> repositories. Is this possible to archive by a maven plugin? If yes
>> what is the best starting point for this?
>
>
> My first question is: What is the background of this question? Means what
> are you trying to solve? What kind of problem do you have?
>
>
>>
>> My own search for this have not revelead any usefull information
>> beside basic maven plugin tutorials that do not cover this specific
>> case.
>>
>
> Kind regards
> Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Maven Plugin that provides alternative repository

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 12/10/17 16:28, Christoph Laeubrich wrote:
> Hi,
> 
> I'd like to create a plugin that gets notified if maven tries to
> download an artifact but does not find it in any of its configured
> repositories. Is this possible to archive by a maven plugin? If yes
> what is the best starting point for this?

My first question is: What is the background of this question? Means 
what are you trying to solve? What kind of problem do you have?


> 
> My own search for this have not revelead any usefull information
> beside basic maven plugin tutorials that do not cover this specific
> case.
> 

Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org