How to find the artifacts that depend on another artifact? - maven-2

We are using Maven to build our projects and Nexus as repository manager.
Is there a way to know where an artifact is a dependency of another artifact?
For example, we want to know which of the artifacts in our Release repository have a dependency on commons-io 1.2, or version x.y of our framework2, or ...

mvn dependency:tree should help you get this info.

Have you looked at the Maven Site plugin in conjunction with the dependencies and dependencies-convergence report from the Maven Project Info Reports plugin?
This will generate an html report that shows all the artifacts that the project uses and what other artifacts that are dependent on that artifact.

The Maven client will only tell you the dependencies of a single project. I'd recommend using Sonar as part of your build process. It's primarily used for source code analysis, but it will also report usage of a particular library by other projects in the same Sonar database.

Related

Automate importing new libraries into Artifactory Ivy repository

We are only using the basic feature of Artifactory for Ant-Ivy java projects. If we need new java libraries, we download JARs, craft ivy.xml, then "deploy" the bundle to our internal Artifactory repository. This has been working just fine. However, when we need a set of JARS that need many transitive dependencies, the tasks become very tedious. We don't use Maven and download JARS from Maven central does not provide ivy.xml file. I am wondering if there is an easy way to automate these process?
Thanks
You can try this Artifactory user plugin which generates missing ivy.xml files from .pom files.
Please note that using a user plugin will require the professional version of Artifactory.

How to include required jars in project while using Maven?

I am new to Maven and using it to build a project on my local. This is working nicely on my local. Now, I want to run the same project on my server and the server does not have Maven installed. So I wanted to ask if there is any way by which, when I build a Maven project on my local, I could include all the required jars in it and then simply transfer it to my server? I know Maven creates the repository in C:\Documents and Settings\username\.m2 on Windows.
But how can I include all the jars in project the way we do traditionally? I saw this question. But it talks about creating a custom repository and I don't have Maven installed at all. so I guess it is not a suitable solution to me.
Thanks.
You can use the Maven Assembly Plugin. From the documentation:
The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive.

MAVEN / Eclipse TargetPlatform

We are building an Eclipse RCP plugin that is based on an Eclipse target platform (also developed internally in our company, by a different department). We would like to compile the plugin using MAVEN2 (we also use NEXUS for repository management).
The target platform consists of about 130 JARs (most of them org.eclipse.*). One way to perform the build would be to add 130 references into the tag of the POM file. Not only is this a lot of effort, but the target platform occasionally changes, so a new target platform would mean a lot of modifications.
Is there a better way to deal with a lot of dependencies in MAVEN?
Take a look at All Client jBoss artifact. They have solved the same problem using POM artifact.

converting websphere portal project to maven

I am working on converting websphere portal project to maven framework for CI build. I am wondering if there is a way to reference websphere jars other than via dependencies in pom.xml and loading them all to maven repository? I cannot imagine loading them ALL to the repository...
Please advice! Thanks!
When using Maven, it is advisable that all dependent jars are installed in the repository. Even Websphere ones.
Ideally a corporate repository will come in handy here, so that you keep a separate repository for all the Websphere jars accessible to all the users in your project. See http://maven.apache.org/repository-management.html for more.
If this is not an option, then use the local file repository explained on a previous questions - here.
You'll still need to add each dependency in POM.
Also read http://sdudzin.blogspot.com/2007/09/maven-2-and-websphere-automated-build.html
if you have a lot of projects that require this, you can also create a parent pom that would have all the dependencies so your project/module/portlet poms are cleaner.

Maven Source Code Dependencies

I have a couple of projects that I'm working on in Eclipse (or any IDE, so I don't want to depend on specific eclipse dependency maven capabilities). Some projects depend on other projects. Typically in Eclipse I would add the projects as references to other projects, but I'm not sure how to handle this when using Maven. In the deployment environment, there will be jars created and the maven build can pull the latest jars from the repository. Is there a way to reference another project's source code using maven while in the dev environment? For example...
I have this scenario:
Project A depends on B
I need to make a change to B and that will require an update to A. I don't want to make the change to B and check it in without checking in A since that will break A. And I would like to manage these dependencies through Maven -- any help would be appreciated.
thanks,
Jeff
The maven 2 eclipse plugin has 'workspace dependency resolution', where the dependencies are first looked up in the workspace, and then in the repository.
What I do is use SNAPSHOT version when doing my development. Project A depends on the latest SHAPSHOT version of Project B, so when I change Project B, I have Team City recompile and push out a new SHAPSHOT artifact to artifactory. Then I clean and compile project A to get the new Project B.