Checkout maven dependency as module in IntelliJ IDEA - maven

I have a maven project that is broken down in a bunch of dependencies, some of which I have RW access to the version control repository.
I'd like switch one from being a read-only dependency to a full project module. Is it possible for IDEA to use the data contained in the POM to do this? I heard that NetBeans does this.

Related

Prevent usage of unmanaged dependencies in modules of maven project

For my project, I would like to prevent in maven modules the usage of dependencies that would not be declared in the dependencyManagement in the parent pom, is there a way to achieve this ?
Thanks
First, you will never be able to completely block the user to add dependency.
User can still add the jar manualy in his code.
Secondly yo can also decompres a module jar and put it in your project.
(actually the same as with a ant build)
It's a good start to maintain a central place with all the version of your dependencies. In a kind of "corporate parent pom".
If your company have a nexus/artifactory, you can "close the door" at that point.
I think that's utopic to have the same version of your dependencies for all your applications. You always want to be able to use the latest feature of the latest version of the dependency.

broken classpath with Intellij Idea on maven dependency

i'm using Intellij IDEA 12.1.6, almost everyone in my company use Eclipse and dont notice my problem. We have a local nexus repository where we deploy artifacts, but some of them are systematically created with an invalid maven-metadata.xml (the latest snapshot timestamp and build number does not match the effective artifact name on repo) and intellij ends up telling me those libraries have broken classpath.
Is there a way to force intellij on hooking the maven jars on my local repository without worrying about those metadata additional information? Eg eclipse hook the jar in his classpath taking the version which does not include those data (in my m2 repo dir i see both 2 jars downloaded, the one with full data and the other one without them)
eg.
library-0.0.6-SNAPSHOT.jar
library-0.0.6-SNAPSHOT-20131028.111135-10.jar
Thank you for your help.
If Importing the eclipse project did not work. You should be able to Configure the library contents . The step for Configure Library Dialog should allow you to point the library to a different location.

Maven build dependency through pom.xml

For my project, I'm using code from another project found on github. I've included the project as a separate folder in my project. My project uses code from that project, so I want to build that project and include it in my project without really making any changes to that project. So how do I specify in my pom.xml to run the sub-projects pom.xml?
If it helps, here is the repository of the other project that I am using: Soda Java
If you're not planning on changing it, simply download it & build it once using Maven. This will install it into your local repository, and you can simply reference it in your pom without any issue.
If you can find it in an external maven repo somewhere, you wouldn't even have to download & build it.
Only if you're planning on changing it do you need the aggregate project approach.
You create an aggregate project with packaging=pom and a modules element that has one module for the dependency and one module for your project, and you build that.

Add a Maven dependency to a Eclipse Plugin project

just a simple question: I need to add a Maven dependency to a Eclipse Plugin project.
The project has not a POM file, so I converted it to a Maven one.
Now I have plugin.xml file and pom.xml file. POM contains the dependency I need to satisfy, but it's ignored; I mean, I can't resolve an import in source code referring to that import.
Can you help me?
ty
I read about Tycho plugin, but online configurations don't work.
If I'm reading this correctly, you've just started by adding a Maven dependency to your project, but don't have the dependency available for Eclipse to validate your code against.
You will need to start a Maven build after you add a brand new dependency so that Maven can add that to your local cached repository. Once the Maven build is done, Eclipse should recognize your imports properly.
You may want to check whether the dependency you are looking for is available in the Eclipse Orbit.
The Orbit project is basically a repository of libraries to make them available for Eclipse Plug-in Development. What is especially nice in the Orbit libraries is that they also provide the sources. Thus, it is possible to view the implementation and get proper JavaDoc and so on.
Example
One can find the com.google.gson library using the update site
https://download.eclipse.org/tools/orbit/downloads/drops/R20190602212107/repository
Thereby, the part R20190602212107 refers to the Orbit build name that you find on the downloads page of the project.

How to make my maven project depend on non maven projects?

I want to create a maven project, which has to depend on a non maven project which in turn depends on 2 other non maven projects. I do not have ownership of any of the other projects and it would not be possible for me to change anything in those projects let alone the structure to conform to the maven structure.
I asked if I could just get jars -- but was told that because of multiple levels of dependency, it would be "difficult" -- although I haven't understood why.
Is this possible or should I just abandon the use of maven to create my project and go with a regular project with jars in the lib folder?
Inxsible
If you can go with a regular project build that means you must have access to the other project's jar files?
It doesn't really matter how the other project builds them, you can still gain more control over your own build process by loading the jars you depend on into a Maven repository.
I'd suggest using one of the following repository managers:
Nexus
Artifactory
Archiva
They'll give you management screens to uploading 3rd party jars, they'll also a more efficient way to use other Maven repositories like Maven Central.
Once you've got your Maven build process working, you could encourage the other projects to automatically publish their versions into your Maven repo.
They could use the ANT tasks provided by the Maven or Apache ivy projects. Worst case you just continue to load their libraries until they see the light :-)

Resources