I work on an industrialized large maven project, and on an application module, I need to be able to send push notifications to Android (with new Google Cloud Messaging).
It seems google provide themselves the server-side library to send the notifications, and according to the mailing list they do not provide any maven repository.
The first step mentionned in the google documentation is:
Copy the gcm-server.jar file from the SDK's gcm-server/dist directory to your server classpath.
I'm not going to do that so i've added the jar to my local repository and will add it to our enterprise Nexus.
mvn install:install-file
-Dfile=gcm-server.jar
-Dsources=gcm-server-sources.jar
-DgroupId=com.google.android.gcm
-DartifactId=gcm-server
-Dversion=r3
-DgeneratePom=true
-Dpackaging=jar
But i've just noticed that the library has dependencies (simple-json, mockito and junit). It's not precised if they are runtime or tests but i guess only simple-json is used at runtime. I think retrieving the GCM dependency from our Nexus should also permit to retrieve the transitive dependencies like this simple-json lib right?
Thus what am i supposed to do? Should i create on my own a pom file for a project i don't own, and then import the project to my maven repository with -DpomFile=my-custom-pom.xml
?
Thanks
To deploy a 3rd party JAR use the deploy:deploy-file goal under maven-deploy-plugin. First, the wagon-provider(wagon-ftp, wagon-file, etc..) must be placed to your ${maven. home}/lib .
Summary. You can use the Maven Dependency Plugin to download dependencies. Run mvn dependency:copy-dependencies , to download all your dependencies and save them in the target/dependency folder. You can change the target location by setting the property outputDirectory .
Finally i've ended creating my own pom.
I've created a maven repository on github here: https://github.com/slorber/gcm-server-repository
Thus anyone can download this jar with maven and also its transitive dependencies.
I've added the files/commands so that you know how i've done.
Add repository:
<repository>
<id>gcm-server-repository</id>
<url>https://raw.githubusercontent.com/slorber/gcm-server-repository/master/releases/</url>
</repository>
And dependency:
<dependency>
<groupId>com.google.android.gcm</groupId>
<artifactId>gcm-server</artifactId>
<version>1.0.2</version>
</dependency>
See https://groups.google.com/forum/#!msg/android-gcm/oukjcHpbLj4/lql_IzpjmUkJ%5B1-25%5D.
It seems that google simply doesn't publish this jar in any maven repository. You have two options:
I would go for the second option. It's not that hard.
Works using:
<dependency>
<groupId>com.google.android.gcm</groupId>
<artifactId>gcm-server</artifactId>
<version>1.0.2</version>
</dependency>
And
<repository>
<id>gcm-server-repository</id>
<url>https://github.com/slorber/gcm-server-repository/raw/master/releases/</url>
</repository>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With