Hi,
On 13/09/17 23:29, Adam Hardy wrote:
On 12/09/17 18:05, Adam Hardy wrote:
when I'm coding a mojo, if I call MavenProject's getArtifacts(), I
can only get artifacts from the project level dependencies.
How do I obtain artifacts from a plugin's dependencies?
The question which comes to my mind: Why do you need the dependencies
of your own ? Aren't the defined in your plugin's pom ?
Maybe I misunderstand a thing here?
Presumably I call something like
project.getPlugin(key).getDependencies()?
If the 'key' required for project.getPlugin(key) is of the form
myGroup:myPlugin:version e.g. com.megacorp:thing-plugin:1.0.2
can I get my mojo's own key programmatically in the mojo to avoid
hard-coding it?
Can you please explain what you are trying to accomplish ?
The users of my plugin define a dependency which the mojo unpacks and
extracts certain files from.
You know that such a plugin already exists?
maven-dependency-plugin:unpack / unpack-dependencies ?
https://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html
Furthermore the question is why do you need only certain files from it ?
At the moment, I have coded the plugin to take the groupId and
artifactId of this dependency via the mojo config.
Sounds good so far...so counting one place...
something like this.
<build>
<plugins>
<plugin>...
<groupId>..</groupId>
</artifactId>..</artifactId>
<version>..</version>
<configuration>
<groupId>Group to be unpacked</groupId>
<artifactId>artifact of being upackage</artifactId>
...
</configuration>
</plugin>
</plugins>
</build>
This strikes me as doppel gemoppelt
I assume you mean duplicated ? ( I understand that; But only a few
people here on the list have german background).
for the user to put that info in
twice.
>I thought I could just enter it once as a plugin dependency in
the user project pom - assuming it would be the only one.
What do you think will the usage as plugin depenency change ?
You can give this via the plugin configuration and which means your
plugin must resolve it's dependencies and make a required download for
it...which can be easily done by using a maven-artifact-transfer[3].
But I don't see the requirement to define it in two place ?
Kind regards
Karl Heinz Marbaise
[1]:
https://maven.apache.org/plugins/maven-dependency-plugin/unpack-mojo.html
[2]:
https://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html
[3]:
https://maven.apache.org/shared/maven-artifact-transfer/install-project.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org