Import jar from ant ivy project to maven - java

I am working on an ant project and i want to use the jar created by it , in my maven project.
The ant project employs ivy to manage its dependency.
Is there any easy way to do this if possible without changing any code on their side.

It sounds like you want to be able to publish artefacts generated by your ivy-based project to a maven repo so they can be resolved by the mvn-based project.
Try http://draconianoverlord.com/2010/07/18/publishing-to-maven-repos-with-ivy.html
Once the ivy-based project has published its artefacts to the mvn repo, then the mvn-based project should be able to resolve the published artefacts.

Related

Import Maven Project as Dependency into Gradle Project

I went through this link to import a gradle project as dependency into another gradle project. Is there a way to include a maven project as dependency into a gradle project?
If that Maven project is built somewhere else and deployed to a Maven repository, you can specify the artifact it produces as a simple compile dependency. If this Maven project is somehow a subproject of a Gradle multi-project build, I suppose you could hack it to work by simply ignoring the Maven POM file and perhaps adding a build.gradle to that project.
To use the solution described on the link that you provided - both projects must be gradle and included in gradle settings. Therefore you can use project closure to compile and depend on the project without building it explicitly.
I am not aware of any way to do this with maven project. I understand you use some maven plugins that you dont want to rewrite in gradle as simply can not find any equivalents etc. Often had that problem.
In this scenario I would suggest to build maven project and depend on a built jar in your gradle project.
Otherwise you could probably amend sourcesets in your gradle project to include maven classes. But I think it would be to complicated.
If I would be you I would turn it into gradle and try to replicate what you had using maven or just build the artifact and depend on it in dependencies closure.
Gradle is not that new anymore and there are many plugins that are superseding old good maven stuff.

Ant use Maven's library

I wrote a project which use maven. It's good for me.
But, some other people don't have maven, so I am trying to write an ant build.xml for them.
My question is:
Inside "javac" -> "classpath" tag, how could ant get the libs I used in the project from maven? So that could compile & pack all the 3rd-party libs into release via ant.
Is this possible or there are better solution for maven & ant exists in same project.
Ant combined with Ivy is your answer. Ant can use a Maven repository to pull in jars, and can even be made to output a pom.xml, so the jar can be deployed back to a Maven repository.
I have an ivy.dir project on Github that I use to help integrate Ivy into already existing Ant tasks -- especially if they use Subversion as a version control system. You can create a ivy.dir subproject, and make that an external on the Ant project.
Have a look at ivy. Use it to download your dependencies for ant from a maven repository.

Does maven import option in intelliJ imports jars from remote repositories as well

Hi I am trying to build maven project using intelliJ.
I wanted to know what the maven import option does?
Apart from importing files from local repository and remote maven repository, does it imports/ updates files from SVN repository (which I am using).
So do I need to checkout the code from repository everytime or import option does this ?
Thanks
The maven import functionality in IntelliJ works as follows:
If you want to use an existing Maven project, you can import it directly by opening its pom.xml file. When a Maven project is imported, it maps to an IntelliJ IDEA module with the name, which is equal to the Maven project's artifactId. Dependencies between the Maven projects map to the dependencies of IntelliJ IDEA modules from the libraries and other modules. IntelliJ IDEA analyzes the pom.xml file and automatically downloads the necessary dependencies.
It will not checkout code from your SVN repository. Maven is a build tool that helps manage dependencies that your package may have, while SVN is a version control system that is meant to track changes you make to code.

Importing maven library and maven sample in Eclipse project

I know its quiet irrelevant question but I have banged my head too much but found no solution for that..I am building android app which can read contents from NFC cards.I am using this library to perform my job https://github.com/devnied/EMV-NFC-Paycard-Enrollment .But there is also the sample app for this library in this link which I can't import in my Eclipse.Also I need to know how to import this library in my project.
Please help me out.
Regards
BSOFT
This is a maven project (indicated by the presence of pom.xml), so you need to first install maven from http://maven.apache.org/download.cgi
Then, navigate to the library root directory and run mvn eclipse:eclipse to generate eclipse project files. You can then import the library into eclipse as a standard Java Project.
To import the library into your own project, run mvn install from the library root directory to build a jar and install it to your local maven repository. In your local project, you can then either add a dependency on the jar (find it in your maven repository, ~/.m2/), or use maven in your own project and add the library as a dependency in your pom.xml.

Integrating a maven project into Eclipse

I have a maven module for validation which I must pass to a old version of Eclipse which has the Jrules API within. However there is not a maven plugin for this eclipse IDE. So I figured I would do a maven:install on the module and move over the created jar.
However when I try to import->Existing Projects into Workspace->Select archive file:
and point it to the jar no projects appear. I'm at a loss as to how I can move my maven module to the outdated eclipse, without having to grab the 101 jars required for the project and non mavenise it...
Surely their has to be an easy way to this or is maven will monolithic
Use the maven-eclipse-plugin to generate the .project and .classpath files for you:
mvn eclipse:eclipse
This will create the IDE metadata files which reference all of the JARs your project depends on from within your local maven repository folder.
Attempting to import the JAR that is built by the Maven build process into Eclipse using the " import->Existing Projects into Workspace->Select archive file" doesn't work because Eclipse expects to find a .zip/.jar file with the .project metadata files and the source code. Your compiled JAR likely contains neither.
I would recommend using the M2Eclipse maven plugin. Right click the project -> Enable Dependency Management -> Update Project Configuration
I have used eclipse:eclipse extensively and my experience is that M2Eclipse is not only better supported but works better overall.

Categories

Resources