BOM for Maven plugins - maven

I'm trying to create a Docker image for Maven that will have the default standard Maven plugins already downloaded.
Is there any Maven BOM that contains or mock pom all the standard maven plugins?

A Maven install is little more than a bootstrap. Most of Maven's functionality is downloaded as a plugin and cached on the first Maven run.
One idea is that you could run the maven command from within the Dockerfile when building your image.
Possibly a more flexible solution would be to run a second Docker container, using Nexus (or similar repo manager) to cache downloaded dependencies:
How to dockerize maven project? and how many ways to accomplish it?

Related

creating spring boot project without maven

I am working recently with spring boot framework
my problem is that I need to set up to environment in a device that has no internet
I have searched A lot but all I found is using maven that will handle the processes of downloading all the dependencies
put I need to add the required dependencies like the old way when you download the jar files and add them to the class-path
is there a way to do so with STS
or is there a way to change where the maven download the dependencies to be from local instead of internet
Never used STS but I assume it uses maven/gradle under the hood.
You can set up local repository and point maven/gradle to it. For example you could use Nexus:
https://www.sonatype.com/products/repository-oss
Another way is to pull dependencies (they get downloaded when you do maven or gradle build and are saved under ~/.m2 or ~/.gradle directories), then copy your ~/.gradle or ~/.m2 directory to the PC with no internet and build offline. With gradle it looks like this.
./gradlew build --offline

Gradle, OSGi and OBR (or other repository?)

previously I've been using Maven and the maven-bundle-plugin to archive the following:
When doing mvn install, local maven repo contains my bundle + all my bundle's deps automatically
Local repo becomes OBR repository by mvn bundle:index, also repository.xml is automatically updated with every mvn install.
Local repo can now be used for Karaf bundle deployment
Now, I'm looking to migrate some projects to Gradle, which is very nice in many ways. I'm successfully creating bundles using the 'org.dm.bundle' plugin (basic 'osgi' plugin did not allow me to auto-create service components).
By using Gradle's maven plugin I can do gradle install to install my own bundle in local maven repo. I could then use bindex to manually (or through some gradle hacking) index the repo.
However, my dependencies are not put into the maven repo, they are only stored in the gradle cache dir. Thus, I can not use the OBR repo to deploy in Karaf yet.
I've been looking around a lot trying to find some good solution to this, but I have not found anything.
I've looked at Karaf feature files, which would allow me to specify mvn URLs directly instead of relying on OBR, but I'd like to avoid messing with feature files manually.
There are references to using Nexus, but only Nexus Pro supports OBR from what I can see?
I'm up for suggestions on alternative solutions as well; the main goal is that I shall be able to deploy my bundles + deps in Karaf. Maven does not have to be used at all really, although I need some way for different Gradle projects to find dependencies from some other projects (which are not part of the same multi-project).
Any ideas or discussions to put me on the right track is appreciated!
This may be a bit late, but I just stumbled over your question while looking for a way to fetch with gradle from an OBR repository.
As far as I understood you want to push (gradle deploy) to some Maven repository and use it as an OBR repository. This is possible with Eclipse Package Drone, eclipse/packagedrone. You can deploy using Maven/Gradle deploy and let it generate a P2, OBR and OSGi R5 index repository.

How to download maven dependencies from Jenkins without a binary repository

Are there any plugins or ways to download the dependencies for a maven project from Jenkins? I am using Jenkins for a multi-module desktop application. Although I know I could just archive all dependencies, I don't see why there isn't the ability to download dependencies using maven which installed on the same machine as Jenkins. Preferably one would specify the location of a pom and then have the ability with one click to download all the dependencies for that pom. Can you do this? I do not need or want an entire binary repository for this feature.
Edit: I will try and rephrase this as I don't think people are understanding.
In Jenkins one has the ability to archive artifacts at the end of a build. Also in jenkins you have integration with maven. When building a jar in maven you have arguablly 2 options:
You can either use the assembly plugin which zips all .class files
together with those produced from your source code resulting in 1 jar
You can create a jar just source code which references all
dependency jars which are located in a separate folder.
In Jenkins one also has the ability to download the latest artifact. Now if I am using Option 2, I can either archieve just the jar which my sources produced, which I would say is more desirable for space and is the whole purpose of the archive functionality, or you can also archive the libraries too.
Here is the PROBLEM!! If I don't archive the libraries then I cannot easily run this jar, as it is a desktop application and its dependencies cannot be obtained in the same mannor as clicking on a link from jenkins. So lets say my question is what is the easiest way to obtain them? Extra info: assume jenkins is running as a server and you can't use artifactory or another server application, that seems to me to be massive over kill.
Use the maven plugin and create a maven job for your project. Jenkins will then use the maven command you provide in the job configuration to build the project. This means maven will download the projects dependencies and store them on the machine jenkins is running. Normally this would be <JENKINS_HOME>/.m2/repository. This way you get a local repository that only contains the dependencies of the projects you created maven jobs for.

Installing maven and the maven eclipse plugin?

I installed maven from here: http://maven.apache.org/download.cgi
and also installed plugin for eclipse from the eclipse marketplace.
This is a really dumb question, but what's the difference between the two?
both are same thing ? or for differnet purposes ?
do we need both on system ?
Maven itself is the software you can use on your machine. It has nothing to do with Eclipse. You can use it from the command line with the mvn command to execute Maven goals on your projects in the file system.
The Maven Eclipse plugin (m2e) integrates Maven with Eclipse so you can comfortably use Maven functionality from inside Eclipse rather than using Maven as an external tool. The plugin just integrates Maven with Eclipse and needs a Maven installation to work. You can configure the plugin to use the Maven installation on your system but there is no need for one. It can use it's own internal "installation" of the actual Maven software. This would be basically the same as you can download and install yourself but it is integrated with the plugin. It therefor can't be used outside Eclipse.

Maven without Internet connection

I'm new to maven project.
I'm changing an ant project to maven project.
To install the 3rd party jar's in maven local repository, I used install command.
Its trying to download the resource jar.pom.
I don't have download access in my organization so the build failed for installtion.
After request i got the resouce jar and clean jar in my desktop(also i can get other necessary jar).
How to make maven to use these jar for the process and how to install the jar in local repository without internet acess.
I downloaded the jar and placed in local repository but it couldn't point the path and use those jars.
please let me know what steps i have follow to run maven install and other commands to build the project without internet access.
where should i placed the jar which i have downloaded by external way.
Please guide me for building and deploying the project.
Thanks in advance.
http://maven.40175.n5.nabble.com/Maven-installation-and-using-in-project-without-Internet-conncetion-tp4564443p4564443.html.
http://www.coderanch.com/t/544641/Jobs-Offered/careers/Maven-installation-project-without-Internet#2471141
I've posted same question in these link
You need an internet connection. Maven isn't initially self-sufficient. It needs to download a bunch of plugins along with their dependencies and the dependencies of your own project. And this really depends on what sort of settings you have for your projects. One set up will require one set of dependencies, another - a whole different one. You can't download artifacts from the Maven Central manually and then install them locally one by one. Simply put, that sounds stupid.
I understand that you're coming from the Ant world where Ant has everything it needs on the local file system. However, Maven relies on the fact that it will have a central repository (either Maven Central, or your own repository - Nexus, Artifactory, etc.) from which to download the plugins and dependencies it needs. There is no point in you migrating to Maven, unless you'll be allowed access to the Central Maven Repository.
Yes, indeed, you can run Maven offline and you can have Maven produce a local repository for you to use when you are in offline mode. However, what you're trying to do is against Maven's principles.
If your company won't allow access to Maven Central, just stick to Ant. Your effort will be a waste of your company's and, ultimately, your own time.
In fact the maven strenght is mainly in the internet accessible repositories and automatic dependency management. But it's possible to use this tool to build your project if you have all dependencies required for your project in your local repository. Then you may use -o option for offline mode and maven will not try to download updated artefact versions.
To get the artifacts into you local repository you have several options:
1) connect to the internet once and mvn build the project (this will download all required dependencies)
2) install dependencies as jar to the local repository manualy (using appropriate mvn command)
I think the questioner is looking for -o or --offline option for mvn. This is a command line option and can be provided while executing.
I think you can setup your repo correctly and execute the mvn goals once when you are connected to internet and use the -o option for later executions .
Hope this helps.
~Abhay
You can configure maven to run in offline mode. Add this entry to your settings.xml
<offline>true</offline>
See here for further information:
http://maven.apache.org/settings.html
Before you can use offline mode, you have to install all necessary third party jars to your local maven repository.
mvn install:install-file
-Dfile=filename.jar
-DgroupId=com.stackoverflow
-DartifactId=artifact
-Dversion=1.0.0
-Dpackaging=jar
-DcreateChecksum=true
-DgeneratePom=true
It's much easier to get those jars in your local repository using an internet connection and online mode.
It's possible to install these resource jars in your local maven repo using install-file. This will make the available to the build. You'll have to do this for each individually, but once that's done you won't have to do anything special.
To be clear, maven puts everything in your local repository, both the jar you're building with this project and the various library jars. Because your system cannot be connected to the internet to maven can populate the local repo with your libraries, you'll have to use this manual approach.
Edit: You should be able to run install-file anywhere. When you do, you'll need to provide the groupId, artifactId, version, and packaging using the command line options. If you already have a POM file for the library, you can provide that instead via -DpomFile=your-pom.xml.
This question has some useful info: How to manually install an artifact in Maven 2?

Resources