How to upload custom jars to Maven repository - maven

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

Related

Add external jar in pom.xml

I have a spring boot application with maven.
I need to use an external jar say "tp.jar". I have used the method of system scope to do the same but seems it has been deprecated. Is there any better alternative which doesn't involve running maven commands to do the same. I found some solutions here Can I add jars to maven 2 build classpath without installing them?
But the posts are pretty old was wondering if any new solution and convenient solution has been found.
If you are in a company doing Java, you probably have a Nexus or Artifactory server running. This is the place to put the jar. Then you can use all Maven mechanisms to use it.

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.

spring 4 security jars are missing for offline download

while working on spring mvc 4, how to find the jar for offline project like the jar Spring Security Config,spring-security-web for spring 4 ... etc as thet are not available with default package of jars and I do not want to use maven at this time so where one can find the jar for spring 4
?
First of all, foregoing proper dependency management is a bad idea and will make development that much harder, especially when it comes to transitive dependency resolving.
However, if you really want to do it then you can download .jars straight from Maven Repository or any other online repo that hosts them.
If that fails then a Google search will give you some source to download them from.
Trying to avoid a dependency management tool that to with a framework like Spring which complements many other frameworks is a bad idea in the long run. It will be painful to upgrade the versions in future.
But if you still don't want to use maven/gradle kind of build tool, just use pom.xml/build.gradle just for onetime use and let maven/gradle download all the dependencies and copy all those jars in some folder of your code.
Again I strongly suggest to use a build tool, especially for Spring. Maven/Gradle are not that bad if you don't want to do crazy things!!

Library to create and upload jar dynamically to maven repository

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

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