Transitive dependencies within my plugin with maven 2 - maven

I'm trying to get all dependencies (include transitives) within my plugin using mavenProject.getArtifacts() but get an empty Set. part of the dependencies which I have to get cannot be resolved. I know that Maven 3 offers the #requiresDependencyCollection but that is no use for me since I must use Maven 2. What can I do?

https://svn.apache.org/repos/asf/maven/shared/trunk/maven-artifact-resolver will help with this.
For an example of its use, see https://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin.

Related

Meaning of SCOPE tag in Maven Dependency

When we use scope tag while providing dependencies in POM file of Maven, we can give several valid values (compile, run, provided etc..). I understand that tag is applicable for only transitive dependencies (i.: list of JARs required by direct dependencies that we give in POM).
When we give the scope as provided, will the dependency not be downloaded from Maven central repository ? Can someone please confirm.
Thanks!
Dependencies with scope provided are meant to be provided by the container in which the application runs (e.g. provided by jboss).
This means that they are downloaded by Maven, put on the compile and test classpath, but not included into the final WAR or EAR you are building.

How to determine plugin id for 3rd party gradle plugin library?

For integration test requirement I want to use gradle plugin 'gradle-processes':
https://github.com/johnrengelman/gradle-processes
So I have added version(0.3.0 is only version I see without our organization) in classpath dependency :
dependencies {
classpath 'com.github.jengelman.gradle.plugins:gradle-processes:0.3.0'
}
along with
apply plugin: 'com.github.jengelman.gradle-processes'
But gradle run fails stating that:
Plugin with id 'com.github.jengelman.gradle-processes' not found.
In my local machine repo I can see the jar get downloaded properly, only issue is I am unable to understand what plugin Id I should apply.
Even I went through
https://github.com/johnrengelman/gradle-processes but couldn't get the answer.
Any help to understand how plugin id get determined for a plugin will be really helpful.
Thanks,
Understood the plugin Id concept, so may be useful reference for someone else
https://guides.gradle.org/writing-gradle-plugins/#declare_a_plugin_identifier

What maven dependecy do I need to support org.zkoss.reference.developer?

What maven dependency do I need to configure to support the following package :
org.zkoss.reference.developer
In maven world you may find the answer by querying the repositories, such as
[http://search.maven.org/#advancedsearch|gav]
Usually gives quite a few hits, but you need a classname

Maven: my class says HttpServletRequest not found

My class complains that it couldn't find HttpServletRequest. I can google and find out what maven dependency to include in the pom file. But , is there any maven command to find out what could be the dependency to include. when we develop any maven based java application, There could be always errors like this. How to tackle them with the help of maven commands ?
Thanks,
Arun
I don't think there's such a plugin (yet). What I would do is use http://search.maven.org/#advancedsearch and fill the classname. Since this searchmethod has an API one could wrap it with a Maven plugin.

Multiple reusable modules in maven

I have a couple of java modules set up in IDEA and I am wanting to mavenize them. These java modules use classes from one another.
I was not quite sure how I should take up this and I decide to add modules on a maven project using IDEA. Hence first I created a maven project, let's name it pm1 which has a class let's name it TempClass1. Now this class can be used in other maven project. Hence I added another maven module - pm11 and tried to use TempClass1 with in pm11. It worked and I notices that IDEA had added module dependency of pm1 in pm11. So whole structure looks as -
But now when I do mvn test from pm11 then it fails with error message package package1 does not exist and it looks to me that it is because package1 is in a different maven project. And I am not sure how I could use classes which reside in a different maven project. I hope I am clear in my question.
You can use classes of other maven projects, as long as there's a proper maven dependency defined in pom.xml. Ensure that the dependency is defined and its' scope is either undefined or relevant (You may have problems if the scope is provided for example).

Resources