On Sun, Aug 31, 2008 at 5:48 PM, Dan Tran <[EMAIL PROTECTED]> wrote:
> Oops, I pasted the wrong declaration, it should be
>
>    /**
>     * Location of the local repository.
>     *
>     * @parameter expression="${localRepository}"
>     * @readonly
>     * @required
>     */
>    protected org.apache.maven.artifact.repository.ArtifactRepository local;
>
> Looks like the expression=${localRepository} is the implicit
> ${settings.localRepository}
>
> Is there a way to pass in   my own localRepository instead of using
> the implicit settings.localRepository.  This way, there is no need to
> enhance the plugin.

Of course, we still need to remove @readonly which is a minimal change
in the plugin


>
> If we need to enhance dependency plugin to allow override of its
> "local" configuration,
> how is it going to be?  Perhaps, we can add an additional
> configuration like localRepositoryPath( String) and create a new
> DefaultArtifactRepository if it is not null to replace the declared
> "local" at execution time?
>
>
> Thanks
>
> -Dan
>
> On Sun, Aug 31, 2008 at 5:25 PM, Brett Porter <[EMAIL PROTECTED]> wrote:
>> You're on the right track, but there's a few problems here.
>> Firstly, I'm a bit confused as you have artifactFactory, but refer to local
>> repository. This is important - if the plugin is using a factory to create a
>> repository then you can replace the factory, but if it's using
>> ${settings.localRepository} you'll have to override that in a different way.
>>
>> As for replacing an implementation, the method you've given is not quite
>> correct. You actually need something like:
>>
>> <configuration>
>>  <factory implementation="com.foo.bar.MyArtifactFactory" />
>> </configuration>
>>
>> A good example of this is the shade plugin, which does so for it's
>> transformers.
>>
>> But if @component is used, or @readonly - this may not work anyway.
>>
>> For the specific use case you are talking about, replacement components
>> shouldn't be needed, it just sounds like you want to modify the local
>> repository. That seems like a feature request to make of the dependency
>> plugin.
>>
>> Cheers,
>> Brett
>>
>> 2008/9/1 Dan Tran <[EMAIL PROTECTED]>
>>
>>> Currently,  a typical localRepository configuration is declared like
>>> this in the mojo.
>>>
>>>   /**
>>>     * Used to look up Artifacts in the remote repository.
>>>     *
>>>     * @parameter
>>> expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
>>>     * @required
>>>     * @readonly
>>>     */
>>>    protected org.apache.maven.artifact.factory.ArtifactFactory factory;
>>>
>>>
>>> This means, I can create my own local repository plexus component
>>> implementation, declare it as a dependency in my pom in the plugin's
>>> dependency list, and pass it in as a execution configuration like
>>>
>>>  <execution>
>>>    <configuration>
>>>       <local>myExecutionLocalRepository</local>
>>>    </configuration?
>>>  </execution>
>>>  </executions>
>>>  <dependencies>
>>>    my implementation goes here
>>>  </dependencies>
>>>
>>> Where myExecutionLocalRepository is the plexus component name, known as
>>> "hint"
>>>
>>> Is the right approach?
>>>
>>> The motivation behind this is that I have a need to use dependency
>>> plugin to copy and unpack some very large artifacts and I dont want
>>> it to pollute my global local repository especially when using
>>> snapshot artifacts.  myExecutionLocalRepository is located under
>>> target directory so that It can be cleanup via maven clean.
>>>
>>> Advice is greatly appreciated.
>>>
>>> Thanks
>>>
>>> -D
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>> --
>> Brett Porter
>> Blog: http://blogs.exist.com/bporter/
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to