How to create a maven repository that others may use? - jar

I have a project that is hosted on github. Now what I want is that just by including a few lines like these, anyone is able to use my library in their maven project.
> <dependency>
> <groupId>org.anahata</groupId>
> <artifactId>anahata-core</artifactId>
> <version>1.0</version>
</dependency>
I am new to maven, so please tell me the exact steps. Can it be hosted from github itself?

You can have your project hosted in the Maven Central Repository following the tips posted here, here and here. See also this question and this one.
Edit: Also Sonatype's guide as suggested by khmarbaise (it is referred to by the guides above).

Not to miss the guide of Sonatype:
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide

Related

Liferay dxp 7.3: how to add third party jars for global sharing?

how can add 3rd party jars for global sharing?
in 6.1, it just need to add those jar files into tomcat's lib/ext folder. but after upgrade to 7.3, those jars seems not loading and cannot reference in portlets.
please help!
thx.
Liferay 7 replaced its whole foundation and switched to OSGi -- you'll need to provide your third-party jars in an OSGi bundle.
(This basically was the answer. Any elaboration would be too much for this site or would need a more specific question. As Liferays documentation is always in flux, search for "liferay include third-party jars in module" for more info. At the time of writing, this link is a relevant search result.)

Google Volley JAR file

I have tried creating a jar file for the Google Volley library but I keep failing. I have tried looking around for the LATEST one, and can't find any. Would it be possible if someone could kindly give me the latest jar file if possible.
Would mean a lot,
Thanks
IMO you can try the Jar file from here or you can use Google Volley source code files in your project as the way I use in my GitHub sample project. Hope it helps!
The best and easiest way is to add the following dependency to your app's build.gradle file:
dependencies {
compile 'com.android.volley:volley:1.1.0'
}
or if you are unable to do so. The other possible solution is cloning the Volley. Clone the repository and then follow this guide to import it as a new module.
git clone https://github.com/google/volley

Jar to include to use javax.annotation.*

I'm a bit confused. I need to compile a project in jDeveloper 11.1.1.6.0. The server side of the project is deployed on the Glassfish server. On the machine of the project's creator everything compiles without any problems.
Using project properties -> Libraries and Classpath I added the libraries such as gf-client.jar, security etc. from $glassfish_home/glassfish/modules and some others (e.g. hibernate3.jar from hibernate dir).
When I try to compile the project I receive the following errors:
package javax.annotation.security does not exist
and
package javax.persistence does not exist.
I suppose that I miss some jars to include. I tried to find which jars (from Glassfish or from JDK) contain javax.annotation.* and javax.persistence.* but I couldn't.
If you have any ideas I would be thankful!
I was having the same problem and was able to solve it by adding a couple of dependencies to the Maven pom.xml file. See this answer for more details.
So I found the source of the problem. The application consists of 2 projects, of which only one (mentioned in the question) uses EJB. I'm not sure if it is the way it should be, but I tried adding ejb-files to another project. And after clean all and rebuild all it compiled like a charm for me. I hope this will help somebody in the future.

Received a main jar file with other jar files that need to be in the classpath. Whats the best way to include this main jar in my maven project?

So i received a java api from a client and the main code is in main.jar. But the instructions he gave me require me to add these other jars (a.jar, b.jar, etc..) into the classpath whenever I want to use main.jar. These other supporting jars are things like Xerces, jakarta-oro, and a few other publicly available libraries. The problem is i don't know what versions they are, so i'm not sure if there would be issues if i just update the pom.xml file in my app to depend on main.jar and also have dependencies to these other jars as well with the latest versions of them.
Whats the best strategy for using main.jar in my maven application? I'm planning on adding main.jar to our internal maven repository, but what should i do about the xerces, jakarta-oro, and other jars when i dont know what versions they are?
Thanks
If you are lucky the file /META-INF/MANIFEST.MF inside a.jar, b.jar etc. contains an entry "Implementation-Version" or some other useful information which tell you what version they are. If not, you can download the latest release(s) from the project web site and check if they have the same file size as your bundled dependencies.
You may also come to the idea to bundle the dependencies with the main.jar in one big jar, but this may become funny, when you have the dependencies twice in your classpath at some point in the future...
What about just asking the client what version numbers this dependencies have?
If you don't have any information about these third-party libraries, just add them to src/resources/META-INF/lib and commit to SVN. That's the best way, if we're talking about black box approach.

Maven and Flex Builder

I use Flex Builder to generate data binding for my Flex app with Blaze DS. When I compile my pp from Flex Builder everything works just fine. But when I try to compile it with Maven I has a problem with missing libraries.
I discovered that maven miss the following libs:
fds.swc, fds_rb.swc
fiber.swc, fiber_rb.swd
serializers.swc, serializers_rd.swc
As a temporal solution I added this libs to my maven repository and everything seems to work fine, but I would like to know names of the proper libs to add to my pom.xml
First of all, are you really using "Flex Builder" (e.g. v3) or are you using "Flash Builder" (v4)?
Also, are you using Flexmojos to compile the Flex project in Maven?
Regardless, you can/should just use the Adobe Flex Maven repository set up by Sonatype/Flexmojos. It is located here:
https://repository.sonatype.org/content/groups/flexgroup/
I use Nexus to proxy this repository for me, but you could just add it to your pom.xml file(s). Hope this helps.
As the SWC's you mentioned aren't open-source by adobe and not included in the sdk, we found manually uploading them to our repo was the only way to overcome the broken build.
cheers
You can find that swc in this repository now
<repository>
<id>sinusgear</id>
<name>SinusGear repo</name>
<url>http://maven.sinusgear.com/maven_repo/</url>
</repository>

Resources