Add library without gradle or maven - java

I'm developing application backend using google app engine, using eclipse as IDE, and I want to use the google's Firebase SDK. In the integration page, Google give these options to install the backend's SDK:
We publish the Firebase Java SDK to the Maven central repository. To install the library, you can simply declare it as a dependency in your build.gradle file:
dependencies {
compile 'com.google.firebase:firebase-server-sdk:[3.0.0,)'
}
If you use Maven to build your application, you can add the following dependency to your pom.xml:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-server-sdk</artifactId>
<version>[3.0.0,)</version>
</dependency>
The backend doesn't use Gradle to build, and I'm not sure about the Maven option. Until now, I always downloaded the jars for the libraries I used
Thanks.

You can always manually download the jar from a central repository like Maven Central Repository. But I would strongly recommend getting familiar with some Java build tool as it will make your life a lot easier.

Related

Azure SDK not importing

I downloaded the Azure SDK and added it as a library to my Netbeans project. However, the imports are still not found. What am I doing wrong?
Normally, a Java library is depended on some dependent libraries which you also download. My suggestion is that you can try to follow the NetBeans quick start document for Maven to install the Azure SDK library & its dependencies via Maven.
The maven repository of Azure SDK is at here, you just add the maven dependency content below within the xml element dependencies to the pom.xml file for your project on NetBeans.
<!-- https://mvnrepository.com/artifact/com.microsoft.azure/azure -->
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.0.0</version>
</dependency>
Then, maven will help downloading & installing Azure SDK jar file & all dependencies when you save the maven pom.xml file.
Hope it helps.

How to build a Java Maven project without internet [duplicate]

This question already has answers here:
How do I configure Maven for offline development?
(15 answers)
Closed 7 years ago.
I'm trying to convert a java project into a Maven project with the Eclipse plugin. However my work environment does not allow any internet connection whatsoever and I cannot compile the code outside of the work environment. I have listed all the Referenced Libraries (which im guessing are the dependency libs) in the original Java project which I was hoping Maven would take from rather than connecting to the internet. Is there a way I can build the Maven project without connecting to the internet>
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.
you can add every jar to maven repository using mvn install command, then use dependency for only added jar. if you use plugins you need do some works for them..you use maven for 1 time with internet then use -o to use maven offline(mvn -o install).
mvn install:install-file -DgroupId=com.example -DartifactId=example -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/jarfile
<dependency>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>1.0</version>
</dependency>

Install library jar in pom maven

I have Java Maven Project with a folder lib with all jars that must be included in my project.
I don't know how I have to modify the POM to add all libraries. I want that Maven uses this libraries and I can use all in the project.
Lets be frank here: you are basically asking how to use Maven but then not use it at the same time. Maven is built around the fact that dependencies are managed from dependable repositories and then you come along and want to bypass that entire system by having local jars anyway as you would have in a project not managed through Maven - like one that is built with ANT.
The true clean solution to "not getting jars from a Maven repository" is to still get them from a repository - your own. Setup a local repository and put your third party dependencies there, then configure your Maven build to know about that local repository. If they are actually dependencies that exist in Maven central then you can setup your local repository to proxy them rather than manually installing them yourself.
http://maven.apache.org/repository-management.html
If you are using the release management features of Maven (or something like Hudson) then you should actually already have such a thing to stick your generated release artifacts into.
You have to know which libraries are you using. Imagine that you use in your project the joda-time library.
So you have to search your libraries (in this case joda-time) in maven repositories and add to your pom.xml like the following:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.7</version>
</dependency>
Here the Maven repository --> Maven Repo

Android Support Library v7 + Maven + Eclipse: apklib dependency not found in workspace

I'm trying to configure the library v7 support in my project so that it uses ActionBarActivity, thus keeping compliant with some of the Android 2.X versions.
First, follow the documentation from Google and imported the project android-support-v7-appcompat as a library in accordance with Section Adding libraries with resources on Support Library Setup. But this way my Maven Build failed because it could not find the dependence of the library in question.
Now, I decided to seek a cleaner solution, keeping my dependences managed by Maven. To do this follow the instructions of the answer, but using version 19.0.1. This made my Maven Build it were executed successfully, but my project is not compiling in my workspace, the following error occurs on first line of my POM:
dependency=[com.android.support:appcompat-v7:apklib:19.0.1:compile]not found in workspace
My dependencies are as follows:
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>${com.android.support-version}</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>${com.android.support-version}</version>
<type>jar</type>
</dependency>
The project in question is on GitHub, if they want to view it: https://github.com/veniltonjr/msplearning
Thank you in advance!
First, there is no apklib for com.android.support:appcompat-v7. It only ships as an aar.
Second, that library is not available in maven-central, it ships with the Android SDK.
You need to manually deploy it to your local maven repository.
Though you can use maven-sdk-deployer to construct and deploy the apk to your local folder. But you github project is failing due to missing internal dependencies.
com.msplearning.android-support-v4:jar:19.1.0, com.msplearning:android-support-v7-appcompat:jar:19.1.0

maven for wurfl 1.4

Is anybody else working on wurfl API version 1.4 (latest stable release). I am stuck on configuring my pom.xml for wurfl 1.4
I do not want to add wurfl manually.
ScintiaMobile says that new wurfl is hosted at their server. But the link they provide does not contain 1.4
In short my problem is I have to use maven and wurfl 1.4
Luca Passani, ScientiaMobile's CTO here.
I know some user of the WURFL java API have requested support for Maven.
ScientiaMobile had removed Maven support in 2011, to avoid that people would inject AGPL code in their code base without fully realizing the implications of the AGPL license (strong-copyleft).
We have now introduced support for Maven for commercial licensees of the library, who can use their ScientiaMobile credentials to interact with our private Maven repo.
Details here:
http://www.scientiamobile.com/page/wurfl-adds-maven-support-for-java-programmers
thanks
Well, if the following doesn't work in your pom.xml file:
<dependency>
<groupId>net.sourceforge.wurfl</groupId>
<artifactId>wurfl</artifactId>
<version>1.4</version>
</dependency>
Then what you could probably do is download the proper JAR and stick it into your organization's maven repository (Nexus, Archiva, etc) by uploading it by hand.
Download the jar from https://sourceforge.net/projects/wurfl/files/ .
Add following in your pom.xml:
<dependency>
<groupId>net.sourceforge.wurfl</groupId>
<artifactId>wurfl</artifactId>
<version>{{the.version}}</version>
</dependency>
Fire the below command:
mvn install:install-file -Dfile=path_to_jar/thejar.jar -DgroupId=net.sourceforge.wurfl -DartifactId=wurfl -Dversion=the.version -Dpackaging=jar
This will add the jar in your .m2 folder which can later be picked while your are building your maven project.

Categories