Library to create and upload jar dynamically to maven repository - maven

I have service based environment in which I have to create a jar and upload it dynamically to maven repository and return the dependency tree for it. Is there any library which will create a jar file and upload that jar file to maven repository and will return me dependecny of uploaded jar. Right now Im creating it with maven goals in eclipse but I don't want that.
Thanks,

If you don't want to use the command line or IDE, have you looked at the Maven API? There's also an 'undocumented' Maven embedder project.
Below are some links that may help you get started, pick the approach that is easier for you, while meeting your requirements:
https://github.com/jenkinsci/lib-jenkins-maven-embedder/blob/master/src/main/java/hudson/maven/MavenEmbedder.java
http://maven.apache.org/ref/3.0.2/maven-embedder/apidocs/org/apache/maven/cli/MavenCli.html
http://q4e.googlecode.com/svn-history/r819/trunk/plugins/maven/core/src/org/devzuz/q/maven/embedder/internal/EclipseMaven.java
http://developers-blog.org/blog/def../2009/09/18/How-to-resolve-an-artifact-with-maven-embedder

Related

Not able to load multiple ( 200+ )external jars from my /lib folder into my Sprirngboot maven/gradle project

I will need to load 200+ external jars( form my local harddisc) into Springboot REST project. Tried many approaches but none of them are working, Much appreciated if someone has solution.
Note: Please do not suggest mvn install or system scope as i need to construct artifacts for 200+ jar's which i dont like to do manually
Tried google add jar's plugin too its just copying the ${basedir}/lib/*.jars into my Maven target folder but not found in runtime.
If your company works with Maven, it should run a Maven repository server like Nexus or Artifactory. When someone builds artifacts, they should be deployed to the Nexus/Artifactory and can then easily be read from there.
If this is not the case and you do not have a Nexus/Artifactory, you need to either install the JARs in your local repository (mvn install:install-file) or you need structure them in the standard repository layout (like log4j/log4j/1.2.17/log4j-1.2.17.jar) and import this directory as repository.
In any case, this will be a lot of manual work (as you already said).

Is it possible to make a maven-repository with a static-website?

Stupide idea but ... is it possible to create a maven repository from a static website?
if I mannualy put pom and jar file on a website with a path similar to the one on any maven repository, then I reference the website as a maven repository from which I try to import dependency, will it work ?
I need it in order to store my snapshot version without publishing them. I don't care of security but I have 0 budget

what is the javaagent.jar dependency from appD

I need to add this to the central repository. But appD does not give its details such as group id, artifact id etc to add in the proper path. What would that be?
AppDynamics doesn't provide it as a Maven dependency and I think it makes sense as well as it there is no application code which needs to call the java agent jars method.
But If you want to make it as a Maven dependency(Maybe so that in your organisation you have a same version of jar used everywhere and provide an easy way to get the jar, which IMO is a good practice), then you have to download java agent jar and put it in your private/public maven repository.
Please see this answer on how to place your own jars to Maven.

How to upload custom jars to Maven repository

I have a custom jar named core-ui-1.0.jar which is based on Spring. I used http://download.java.net/maven/2/ repository to download spring jars to compile my java files inside core-ui-1.0.jar. Now my core-ui-1.0.jar is ready to release
Can someone help me how can I release my core-ui jar to http ://download.java.net/maven/2/ so that any person can download it from maven 2 repository the way we download spring, hibernate jars etc.
Please let me know if I have the right to upload anything to http://download.java.net/maven/2/ or am I thinking in wrong direction.
Thanks in advance.
You need to create a release. I suggest using the maven-release-plugin if you're build is based on maven.
To have your artifacts available in maven central follow the instructions here:
http://maven.apache.org/repository/index.html (and follow the links)
http://maven.apache.org/guides/mini/guide-central-repository-upload.html
I think this applies best to your project: http://central.sonatype.org/pages/ossrh-guide.html
http://central.sonatype.org/pages/requirements.html
http://central.sonatype.org/pages/choosing-your-coordinates.html

Dynamic loading of Maven artifacts at runtime

At runtime my app would like to add functionality dynamically. We'd like to be able to download artifacts from a Maven repo, add them to the classpath, and use them without doing an app server restart. Possible?
I have come across Eclipse Aether, which give programmatic access to Maven repos. Now the missing piece is the dynamic classpath.
Aether from Sonatype is what you need. Try to use jcabi-aether, which is a wrapper around Aether:
File repo = this.session.getLocalRepository().getBasedir();
Collection<Artifact> deps = new Aether(this.getProject(), repo).resolve(
new DefaultArtifact("junit", "junit-dep", "", "jar", "4.10"),
JavaScopes.RUNTIME
);
All you need to know is a list of remote Maven repositories, a local repo location, and Maven coordinates of the artifact to start with.
If you're not against using a commercial product, one option is LiveRebel

Resources