What is the recommended Eclipse (4.2) configuration for building a Google Cloud Endpoints Android Client Project?
Running Google -> Generate Cloud Endpoint Client Library yields a /libs within my Server project that contains:
commons-logging-1.1.1.jar
google-api-client-1.12.0-beta.jar
google-api-client-android-1.12.0-beta.jar
google-api-client-appengine-1.12.0-beta.jar
google-api-client-java6-1.12.0-beta.jar
google-http-client-1.12.0-beta.jar
google-http-client-android-1.12.0-beta.jar
google-http-client-appengine-1.12.0-beta.jar
google-http-client-gson-1.12.0-beta.jar
google-http-client-jackson-1.12.0-beta.jar
google-http-client-jackson2-1.12.0-beta.jar
google-oauth-client-1.12.0-beta.jar
google-oauth-client-appengine-1.12.0-beta.jar
google-oauth-client-java6-1.12.0-beta.jar
google-oauth-client-jetty-1.12.0-beta.jar
google-oauth-client-servlet-1.12.0-beta.jar
gson-2.1.jar
guava-jdk5-13.0.jar
httpclient-4.0.3.jar
httpcore-4.0.1.jar
jackson-core-2.0.5.jar
jackson-core-asl-1.9.9.jar
jdo2-api-2.3-eb.jar
jetty-6.1.26.jar
jetty-util-6.1.26.jar
jsr305-1.3.9.jar
transaction-api-1.1.jar
xpp3-1.1.4c.jar
Does my Client need to include all these .jar files? If I copy them all into the /libs folder of my Android Client Project and do Build Path -> Add, I get the errors:
Dx trouble processing "javax/xml/namespace/QName.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
and
Dx trouble processing "javax/transaction/HeuristicCommitException.class"
So I need to manually remove xpp3-1.1.4c.jar and transaction-api-1.1.jar from my Client /libs for a clean build.
Is this the "standard" way of building a Client project? How can I determine what are the required .jar libraries for building on Android? Can I configure Eclipse to dynamically import only this subset into my Client?
If I update my Endpoint classes within my Server project in the future and re-run Generate Cloud Endpoint Client Library, do I only need to copy the generated source code under /com/google/api/services to my Client project?
You only need these jars in your Android project:
google-api-client-1.12.0-beta.jar
google-api-client-android-1.12.0-beta.jar
google-http-client-1.12.0-beta.jar
google-http-client-android-1.12.0-beta.jar
google-http-client-gson-1.12.0-beta.jar
google-oauth-client-1.12.0-beta.jar
gson-2.1.jar
guava-jdk5-13.0.jar
jsr305-1.3.9.jar
The other dependencies are included for running the library within other environments.
In general, the dependencies are fixed between runs of generating the client library. However, the generator will use the newest version of the client library, so if that's upgraded in the background, the dependencies might need to be upgraded as well.
Related
I just recently used Github, and when I was trying to upload my java project I realized that I was using some external libraries like apahce poi in this project, and these files have to be stored in libs for my application to function, do I need to upload these files because I realize that might violate some issues(maybe ?).
If yes, then what is the correct way to upload or maybe just post a link to those dependency
Use a tool that provides a dependency management system such as Maven or Gradle (these are both common choices in the Java ecosystem). Your project will then include a configuration file that Maven or Gradle will use to download dependencies so you don't need to distribute them with your project.
I have a java based appengine endpoint project in eclipse.
When I generate client library using command line tool.
https://developers.google.com/appengine/docs/java/endpoints/endpoints_tool
I'm getting only source based jar file ('project_name_version'.java-1.18.0-rc-sources.jar). It does not work fine in Android Studio when I add as a Library.
How can I get class based jar client library (google-api-services-'project_name_verison'-1.18.0-rc.jar)?
I tried searching online but no luck yet.
You could always zip up the sources file and use them in Android Studio. However , note that in the build.gradle file, you will have to reference the other dependent JAR files + versions that will be needed by the sources that you have generated in Eclipse via the Generate Cloud Endpoint Library option.
Build your app engine back end with JRE 7. You can change this from windows->preferences->java->installed JREs. You'll find an Add button at the right side of the pane. For more detail refer this Tutorial
This will solve most of your problems.
I have a Java EE web application written in Eclipse and deployed on WebLogic.
When I deploy it from Eclipse (as a virtual application) it works fine. When I try to create an EAR file and deploy it from the WebLogic console I get a ClassNotFoundException.
What could be the reason?
How can I create an EAR file that will match the structure of the virtual application so it will work?
Usually this means a dependent library is not being deployed. This tends to be where Eclipse has a dependency which it fulfills as part of the internal build. When building it yourself, work out which libraries you need, and which are part of your application, and which are part of WebLogic. For your own libraries (ie those in the lib folders, or those that SHOULD be in the lib folder) make sure they are on the classpath. For external libraries, ie those WebLogic fulfills, make sure you have the appropriate schema descriptors setup to tell weblogic which libraries it needs to deploy with your application (typically things like JSF).
If you want proper control over the build, take a look at things like Ant. You basically tell it via xml what is needed, put it together, and it generates the Ear/Jar file for you (the Ear file containing all the dependencies as well, and/or with your descriptors for weblogic built in libraries).
If you are planning many builds, I find Ant useful once setup (you can tie it in with other programs too, so it can push a build to your Source Control Server as a tag, build documentation, etc). Ant can be a pain though- you need build descriptors for each library you need to build, as well as the Ear file.
Eclipse's Web Tools Platform (WTP) allows you to configure Tomcat to "Server modules without publishing":
Web content will be served directly from the "WebContent" folder of the Dynamic Web Project. A customized context is used to make the project's dependencies available in the Web application's classloader.
In a 5 step process (just joking, you pick the # of steps), what happens technically and where are the files that Eclipse generates? I did notice that Eclipse generated a org.eclipse.jst.server.tomcat.runtime.70.loader.jar file in the Tomcat lib directory.
The idea is to serve a web application directly from the scattered directory structure of the development workspace, without packaging modules into JARs which then end up in WEB-INF/lib in a WAR.
The main benefits are:
You don't need to build archives.
When you change a resource in your workspace, the change is reflected in the running webapp without redeploying the webapp or restarting the server.
With Servlet 3.0, web resources may also be bundled in library JARs in META-INF/resources, so classes and resources may come from multiple workspace directories.
Tomcat 7.0 supports a VirtualWebappLoader and a VirtualDirContext to configure a web application based on a collection of scattered resource and class directories.
To serve your web app directly from your Eclipse workspace, WTP generates a suitable Tomcat configuration matching your project structure
in $WORKSPACE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/conf/server.xml
For some reason, WTP does not directly use the Tomcat loader and context implementations but has its own WtpDirContext and WtpWebappLoader which are slightly different but similar. (I believe this approach is older than the current solution in Tomcat. There is some special logic for TLD scanning - I'm not sure if this is still required with the latest Tomcat versions.) These helper classes are contained in the org.eclipse.jst.server.tomcat.runtime.70.loader.jar you noticed.
Without Serve modules without publishing, when you change a web resource in META-INF/resources in a library module, this change will not be directly visible in the running application after reloading the current page in the browser.
I am building some small Java application to run on Goole AppEngine.
It is not clear to how should I configure eclipse so I'll be able to compile my project but I won't deploy stuff that already exists in on the platform.
(I've tried to read about the subject - here for example - but stil. it is not clear to me).
For example:
The Jersey and the Junit jars - I want them to be uploaded with my code to the cloud in the deployment process.
The AppEngine jars -I need them only for my design time - to be able to write code that is using the platform classes, but I don't want to upload them in the deployment process as they will be available to me by the platform.
Please help to get it right.
I think you need to read a bit from here Google Plugin for Eclipse
And also get the plugin from there, in addition , add the Jersy and the Junit (check first that the API's are on the WillItPlayInJava list) to the build path of the project
WillItPlayInJava