You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Berry <ch...@gmail.com> on 2008/03/24 18:46:57 UTC
custom dependency type
Greetings,
I am wondering if there is a standard solution to this problem anywhere.
I can't seem to find one, but I could have easily have overlooked it...
What we need to do is; download a file, put it in the local repo, and
also on the classpath.
To make this concrete, I'll explain our use-case. I would like to;
1) create a dependency on a RelaxNG schema (a RNC file) in the POM;
<dependency>
<type>rnc</type>
<groupId>com.foo</groupId>
<artifactId>foobar</artifactId>
<version>1.1</version>
</dependency>
2) hook up some plugin in the POM, telling it to recognize RNC types,
and to do its work during resource resolution phase
3) the plugin would
3.1) download the RNC to the local repo
3.2) copy it to target/classes, so that we can use it as
Classpath resource (to do RelaxNG validation)
This seems like it might be something people would commonly want to
accomplish. Not just for RNC files, but for any custom type.
We've hacked up a custom plugin to do this. But it doesn't seem like
we should have too ???
If we do have to create a custom plugin, could someone give a synopsis
of the best practice for accomplishing this??
I'd like to verify that we've done it the best way...
Thanks,
-- Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: custom dependency type
Posted by Chris Berry <ch...@gmail.com>.
Thanks. That worked great.
For posterity here is the code
Cheers,
-- Chris
pom.xml
.....
<dependency>
<groupId>com.foobar</groupId>
<artifactId>foo</artifactId>
<type>rnc</type>
<version>${fooVersion}</version>
</dependency>
<dependency>
<groupId>com.foobar</groupId>
<artifactId>bar</artifactId>
<type>rnc</type>
<version>${barVersion}</version>
</dependency>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeTypes>rnc</includeTypes>
<outputDirectory>${project.build.directory}/
classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
On Mar 24, 2008, at 5:28 PM, Brian E. Fox wrote:
>
>>> Unless I've misunderstood you, the standard maven-dependency-plugin
>>> does
>>> what you want:
>>> http://maven.apache.org/plugins/maven-dependency-plugin/
>>>
>>> See the "dependency-copy" goal in particular.
>>>
>> [cwb] this is not really sufficient. We want
>> 1) to use <dependency> elements, so that the dependency is clearly
>> expressed in the POM (rather than buried in the plugin config)
>> 2) to have the artifact copied to the local repo (for reuse) AND to
>> target/classes
>
> Use dependency:copy-dependencies instead. This will copy all
> dependencies of the current project, but you can filter it down to a
> specific artifact that you want.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: custom dependency type
Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
>> Unless I've misunderstood you, the standard maven-dependency-plugin
>> does
>> what you want:
>> http://maven.apache.org/plugins/maven-dependency-plugin/
>>
>> See the "dependency-copy" goal in particular.
>>
> [cwb] this is not really sufficient. We want
>1) to use <dependency> elements, so that the dependency is clearly
>expressed in the POM (rather than buried in the plugin config)
>2) to have the artifact copied to the local repo (for reuse) AND to
>target/classes
Use dependency:copy-dependencies instead. This will copy all
dependencies of the current project, but you can filter it down to a
specific artifact that you want.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: custom dependency type
Posted by Chris Berry <ch...@gmail.com>.
Comments inline.
Thanks for responding.
Cheers,
-- Chris
On Mar 24, 2008, at 2:05 PM, simon wrote:
>
> On Mon, 2008-03-24 at 12:46 -0500, Chris Berry wrote:
>> Greetings,
>>
>> I am wondering if there is a standard solution to this problem
>> anywhere.
>> I can't seem to find one, but I could have easily have overlooked
>> it...
>>
>> What we need to do is; download a file, put it in the local repo,
>> and
>> also on the classpath.
>>
>> To make this concrete, I'll explain our use-case. I would like to;
>>
>> 1) create a dependency on a RelaxNG schema (a RNC file) in the POM;
>>
>> <dependency>
>> <type>rnc</type>
>> <groupId>com.foo</groupId>
>> <artifactId>foobar</artifactId>
>> <version>1.1</version>
>> </dependency>
>>
>> 2) hook up some plugin in the POM, telling it to recognize RNC types,
>> and to do its work during resource resolution phase
>>
>> 3) the plugin would
>> 3.1) download the RNC to the local repo
>> 3.2) copy it to target/classes, so that we can use it as
>> Classpath resource (to do RelaxNG validation)
>>
>> This seems like it might be something people would commonly want to
>> accomplish. Not just for RNC files, but for any custom type.
>>
>> We've hacked up a custom plugin to do this. But it doesn't seem like
>> we should have too ???
>>
>> If we do have to create a custom plugin, could someone give a
>> synopsis
>> of the best practice for accomplishing this??
>> I'd like to verify that we've done it the best way...
>
> Unless I've misunderstood you, the standard maven-dependency-plugin
> does
> what you want:
> http://maven.apache.org/plugins/maven-dependency-plugin/
>
> See the "dependency-copy" goal in particular.
>
> Regards,
> Simon
[cwb] this is not really sufficient. We want
1) to use <dependency> elements, so that the dependency is clearly
expressed in the POM (rather than buried in the plugin config)
2) to have the artifact copied to the local repo (for reuse) AND to
target/classes
So we just want a simple dependency type (rnc) that does this little
bit of lifecycle
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: custom dependency type
Posted by simon <si...@chello.at>.
On Mon, 2008-03-24 at 12:46 -0500, Chris Berry wrote:
> Greetings,
>
> I am wondering if there is a standard solution to this problem anywhere.
> I can't seem to find one, but I could have easily have overlooked it...
>
> What we need to do is; download a file, put it in the local repo, and
> also on the classpath.
>
> To make this concrete, I'll explain our use-case. I would like to;
>
> 1) create a dependency on a RelaxNG schema (a RNC file) in the POM;
>
> <dependency>
> <type>rnc</type>
> <groupId>com.foo</groupId>
> <artifactId>foobar</artifactId>
> <version>1.1</version>
> </dependency>
>
> 2) hook up some plugin in the POM, telling it to recognize RNC types,
> and to do its work during resource resolution phase
>
> 3) the plugin would
> 3.1) download the RNC to the local repo
> 3.2) copy it to target/classes, so that we can use it as
> Classpath resource (to do RelaxNG validation)
>
> This seems like it might be something people would commonly want to
> accomplish. Not just for RNC files, but for any custom type.
>
> We've hacked up a custom plugin to do this. But it doesn't seem like
> we should have too ???
>
> If we do have to create a custom plugin, could someone give a synopsis
> of the best practice for accomplishing this??
> I'd like to verify that we've done it the best way...
Unless I've misunderstood you, the standard maven-dependency-plugin does
what you want:
http://maven.apache.org/plugins/maven-dependency-plugin/
See the "dependency-copy" goal in particular.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org