Maven repository for java.nio - file

I am writing an application in Java 6 (I have to stick with this).
I need to write a module for file watcher.
After googling around, I found that Java 7 java.nio package is good.
I want to import this sub package alone to maven [my repository] and create the module.
Can any one guide me how can i achieve this? is there any maven repo for such sub-modules?

All the java.nio packages are part of the rt.jar of the basic JRE. So they are not present in any other Maven package, since they assume you already have it.
If you want to use NIO from Java 7, you could package and deploy all or part of the rt.jar as a Maven module onto your own repo, but I wouldn't recommend it.

You can add this:
compile group: 'com.jtransc', name: 'jtransc-rt', version: '0.3.1'

Related

NoClassDefFoundError: Could not initialize OauthRawGcsServiceFactory on production environment

I'm using appengine-sdk 1.9.3.
In devserver, works in Eclipse and Ant normally.
When I deploy (update) to appengine (production environment), I get this error:
event.getResults(): [<pre>Error for /p7/formPanelServlet
java.lang.NoClassDefFoundError: Could not initialize class
com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsServiceFactory
at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:42)
at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:34)
at com.bitvisio.p7.server.FormPanelServlet.<init>(FormPanelServlet.java:27)
At FormPanelServlet.java:27, the code is:
private final GcsService gcsService = GcsServiceFactory
.createGcsService(new RetryParams.Builder()
.initialRetryDelayMillis(10)
.retryMaxAttempts(10)
.totalRetryPeriodMillis(15000)
.build());
I put the lib appengine-gcs-client-0.3.9.jar in war/WEB-INF/lib. I think there is a problem with this lib.
Thanks for help.
Always use tools like Maven or Ivy to resolve dependencies for you. Copying JARs to war/WEB-INF/lib/ directory and editing .classpath file manually will be painful and may not help you always. If you use Eclipse & Google App Engine plugin, use Add Google APIs... as mentioned here - Google Plugin for Eclipse. In my case, adding Cloud Storage API via Google Plugin for Eclipse helped resolve this NoClassDefFoundError.
I had the same problem. I use Ivy to resolve dependencies and always get the latest.integration (with Maven use RELEASE) for revisions.
However I usually ignore transitive libraries. It looks like Google is expanding the API family - at least splitting out discrete functionality.
There are now quite a few transitive dependencies and it seems they released a new version of the GCS client around the same time as 1.9.3.
Getting all dependencies and packaging them in my deployment fixed my issue. I did not have the issue in development which made it more confusing.
You are facing this issue because you are not adding the some of the jar like
google-api-services-storage-v1-rev78-1.22.0.jar download link
joda-time-2.94.jar download link
guava-19.0.jar link to download
you can use the different version of jar according to your appengine-gcs-client jar file.
Note : Add all these jar and build path with the project and problem will get solve.

appengine-maven-plugin versus maven-android-plugin

I'm trying to use Google Cloud Endpoints with Android client, built by Maven.
The problem is that appengine-maven-plugin v1.8.3+ require Maven v3.1.0+
[ERROR] Failed to execute goal com.google.appengine:appengine-maven- plugin:1.8.4:endpoints_get_discovery_doc (default) on project pro-gae: The plugin com.google.appengine:appengine-maven-plugin:1.8.4 requires Maven version 3.1.0 -> [Help 1]
while android-maven-plugin v3.6.1 doesn't (and will not) work with Maven v3.1.0 (see devs discussion at https://code.google.com/p/maven-android-plugin/issues/detail?id=395). The error
A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.1:generate-sources: Lorg/sonatype/aether/RepositorySystem;
So I'm kinda locked out. One plugin asks for v3.1.0+, while the other one claims Maven 3.1.0 to be fatally buggy. So I left out to generate Endpoints client sources manually.
Any other ideas, besides waiting for fixed Maven 3.1.1? It doesn't seem to happen soon, because Maven 3.1.0 was released more than two months ago.
The latest version of the Android Maven Plugin is 3.8.0 and it now requires Maven 3.1.1+. This should allow you to use the latest appengine plugin as well. And Maven 3.1.1 has been released in the meantime as well.
Update Sept 2015: Latest version of the plugin is 4.3.0 with 4.3.1 around the corner. The 4x branch works with Maven 3.0.5+ but we strongly encourage users to use the latest Maven release.
Hmm, looks resolved by just using older version (1.8.2) of appengine-maven-plugin.
One other way of building is to configure the Run Configuration to use an external Maven Runtime.
To do this in Eclipse for Windows :
Right Click Project -> Run Configuration -> Create a new configuration -> In Main tab configure Maven Runtime.
I hope this helps.

With maven, do I still need to configure jdb driver and datasources?

I want to write an Java EE 6 app, on JBoss 7.1, with JPA (Hibernate as JPA provider) and SqlServer.
The build tool is, for better or worse, Maven 3.
What does Maven arrange/set up for me in terms of connecting Jboss 7 to a database and JPA?
Do I need to set up a JDBC driver, as well as a datasource, or does Maven automagically set these up for me via transitive dependencies and its build cycle? In other words, do I need go into standalone.xml as well as into the module folder and modify a module.xml file, etc?
I can't find a tutorial that has all of the steps or a sample pom.xml.
No Maven will not automagically set up dependencies on JDBC providers. You must declare them explicitly in your own project pom.
As far as a tutorial, the canonical references and tutorials are on the Sonatype web site.
See: Maven by Example
and specifically regarding project dependencies in Maven: the Complete Reference:
http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-project-dependencies.html

DataNucleus libraries and maven-gae-plugin

I'm using maven-gae-plugin to manage a Google AppEngine project but I don't know how to include the libraries required to use JPA.
Google's documentation says:
The classpath must contain the JARs 'datanucleus-core-*.jar', 'datanucleus-jpa-*', 'datanucleus-enhancer-*.jar', 'asm-*.jar', and 'geronimo-jpa-*.jar' (where * is the appropriate version number of each JAR) from the 'appengine-java-sdk/lib/tools/' directory, as well as all of your data classes.
How can I tell the plugin to put all the jars in the classpath?
So far I just edited the pom.xml file setting gae.version to 1.7.3 (Leaving datanucleus.version to 1.1.5 and I run mvn gae:unpack but I cannot get it to work.
First, I have problems with javax.persistance that is not found. Do I have to add it manually to pom.xml?
If I do it, the development server starts, but I cannot work with the storage: I get the following error:
SEVERE: Found Meta-Data for class com.sharecost.entities.User but this class is not enhanced!! Please enhance the class before running DataNucleus.
I found a solution to the second part of my question. Looking at the POM.xml file I discovered that the all entities are supposed to be in a **/model package.
I still don't know if the manual inclusion of the javax.persistence dependency is actually required.

Missing archetype.xml in new archetype created from project

I am using Maven 2.2.1. and am new to Maven. I am trying to create an archetype based on an existing project. I have been using this blog post as a guide: http://blog.inflinx.com/category/m2eclipse/
Step 7 says "The next step is to verify that the generated archetype.xml (located under srcmainresourcesMETA-INFmaven (sic)) has all the files listed and they are located in the right directories."
My generated archetype does not have an archetype.xml. It does have an archetype-metadata.xml file though. There aren't any errors in the output from calling archetype:create-from-project, just a couple of warnings about using platform encoding (Cp1252).
Any thoughts on why this file wasn't generated?
Thanks in advance!
Archetype.xml is from version 1 of the plugin, whereas the the archetype-metadata.xml is used in version 2+. I don't believe it is a problem, unless people are trying to create projects from the Archetype using Maven 1 which isn't aware of the change in config files.

Resources