eclipse-che workspace wont recognize new maven dependencies - eclipse-che

Tried searching about this but found nothing that could help me and so here i am...
I like the concept of Eclipse on the cloud and started giving it a try with the first basic hello world example. I created the first workspace with java-maven stack with the given console-java-simple project. I was able to run the app, debug it and what not... Next i added a simple maven dependency like apache-commons-math3 to the pom.xml
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6</version>
</dependency>
and initiated the maven build, all good here... was able to see the jar imported to the m2 repo. When i try to import something, the editor doesn't seem to recognize the dependency. It complaints with the following
The import org.apache cannot be resolvedJava(268435846)
I ignored this error in the editor and initiated the maven build, but java compiler had the same issue and the build failed.
So am i missing something that's so obvious that everybody else is able to figure out :-)
Side Note: I was able to import this same dependency in a java-springboot-msql worksapce without any problem by following the same exact steps.....

If build.gradle file exists then Grandle is used as build-automation system.

Related

Using Cypress.io to test React in a Maven project

I'm currently working on a project and want to use Cypress to write tests for my app that is being made in React. It seems however that Maven is acting up, and after a lot of Google-Fu I got stuck. It seems I'm missing parts of a module, but I was unable to find what kind.Here is an image of said failure.
What am I missing? Thanks in advance.
Missing package maven compiler plugin reports is inside mozilla rhino jar. Try adding following dependency in to your pom.xml
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.8</version>
</dependency>

Should com.google.appengine:appengine-api-1.0-sdk be used with gradle-appengine-plugin?

I am trying to use the gradle appengine plugin with my project but packages from the SDK are not being resolved.
I see many references around the web to the maven repository: com.google.appengine:appengine-api-1.0-sdk. The official documents make no reference to this and I would like to know if I should be using it with the plugin or not.
Is specifying the dependency:
compile "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}"
An alternative to using the plugin's appengineDownloadSdk=true or downloading it manually and setting appengine.sdk.root=... ?
If I don't include that dependency (but do provide the SDK and set appengine.sdk.root OR use appengineDownloadSd/appengineSdk), I see this error when compiling
error: package com.google.appengine.api.datastore does not exist
If I do include that dependency, the compileJava task gives:
The import com.google.appengine cannot be resolved
and gives a reference to the line:
import com.google.appengine.api.datastore.DatastoreService;
from my code.
In the second case IntelliJ is able to resolve the import and can show me exactly where the SDK file is but gradle still can't seem to find it.
When using gradle, you must explicitly define all the compile dependencies. The appengineSdk dependency is for tooling purposes only, it allows the plugin to call into the sdk for things like "update" and "run". It doesn't add any dependencies to your project
com.google.appengine:appengine-api-1.0-sdk:${appengineVersion} is a dependency that lets you use the appengine APIs (like datastore), so you need it to import DatastoreService, so you definitely should be including it as a compile dependency.
Why the ide picks it up and gradle doesn't is probably a configuration problem. I tried reproducing it, but adding the dependency and referencing DatastoreService works without issue in the IDE and from the commandline. Is there anything about your configuration that could be off here?

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.

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.

Maven problems using GAE and DataNucleus

I'm having trouble retrieving 2 artifacts in my Maven/Java/Google App Engine project:
com.google.appengine.orm:datanucleus-appengine:jar:1.0.7.final
com.google.appengine:appengine-api-1.0-sdk:jar:1.3.4
There's a similar question posted, but each answer brings me back to the same error message.
More detail
I don't know if it is relevant, but rather than a version number, my original dependency for DataNucleus contained a variable. I am using Eclipse.
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.version}</version>
<scope>runtime</scope>
I did not include my stack trace in Maven for brevity's sake. Please let me know if it would help to post it. Thank you.
UPDATE
I was able to get the DataNucleus artifact by changing the version from 1.0.7.final to 1.0.6.final (check this repo) and rolling back to AppEngine 1.3.3 (thanks, #Taylor!). However, I still can't find the repo for appengine-java-sdk:jar:1.3.3. There are no jar files hosted at Google Code.
Does anyone know where to find the appengine-java-sdk jar?
Version 1.3.4 of the App Engine SDK is not yet supported by the maven-gae-plugin. Please see the issue here.
Also, based on your latest edit to the question you should NOT be using version 1.3.3. Rather, you should be using version 1.3.3.1 (see here). Also, the appengine-java-sdk jar is available in the maven-gae-plugin repo (see here).

Resources