I'm trying to create the library of my backend project on Google Cloud to export it in an Android project. I'm following this guide:
https://cloud.google.com/appengine/docs/java/endpoints/consume_android#adding_the_client_library_to_the_project
This is what I wrote in cmd (as the guide said):
endpoints.cmd get-client-lib --war=<project-WAR-directory> -bs gradle com.app.example
but I got into this error:
INFO: Successfully processed <my_project_path>\war\WEB-INF/appengine-web.xml
Error: com.app.example
How can I avoid this error?
If you really just want to use the endpoints.cmd directly (you need to include the full path to your endpoint class, not the packageName):
endpoints.cmd get-client-lib --war=<wardir> -bs gradle com.app.fqn.EndpointClass
I believe that's why you're getting that error at the end
Alternatively if you're using android studio with appengine/endpoints, you might try the guide here : https://github.com/GoogleCloudPlatform/gradle-appengine-templates
If you're using gradle for a stand alone appengine project and just want to generate client library you can try some of the endpoints gradle commands (from https://github.com/GoogleCloudPlatform/gradle-appengine-plugin#tasks).
gradle appengineEndpointsGetClientLibs (will download the zip)
gradle appengineEndpointsExportClientLibraries (will download and jar the client libs)
gradle appengineEndpointsInstallClientLibraries (will download, package and install to local maven repo)
Related
I would like to automate the process of changing the version of the API I use in my java project (from the pom.xml) and build the project automatically in a branch on Azure DevOps.
I'm working on a java project right now, and I'm using another external project (equivalent of API to communicate with another application). What I do at the moment is manually check the current API version (external project) that I see on my Azure DevOps dashboard (Screenshot bellow), and I manually change on my pom.xml from my java project. What I want: Automate this process so that after each new version of the API, the build of the new version on my project is done automatically without intervention and on a separate branch for example
Azure dashboard
You can add Replace Tokens task in the build pipeline for the source project (or you mean "external project") and replace the version of the API in your java project (from the pom.xml) with the variable $(Build.BuildNumber).
the build pipeline for the source project:
I'm trying to setup the sample app to load 100 docs in MarkLogic server using the spring batch git documentation but I get this error everytime I try to run my job:
*** What went wrong:
Execution failed for task ':runYourJob'.
> Could not resolve all files for configuration ':testRuntimeClasspath'.
> Could not download marklogic-xcc.jar (com.marklogic:marklogic-xcc:9.0.2)
> Could not get resource 'https://jcenter.bintray.com/com/marklogic/marklogic-xcc/9.0.2/marklogic-xcc-9.0.2.jar'.
> Could not GET 'https://repo.jfrog.org/artifactory/libs-release-bintray/com/marklogic/marklogic-xcc/9.0.2/marklogic-xcc-9.0.2.jar?referrer'.
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target**
The URL for the basic setup is here: https://github.com/marklogic-community/marklogic-spring-batch/wiki/Getting-Started
I'm using IntelliJ as the IDE & also tried to download & add the .jar to the classpath dependency. I'd appreciate any help here. I'm not sur if this could be a gradle issue.
EDIT: This error is common while building any marklogic gradle app & not specific to spring. I'm using MarkLogic 10 & gradle version 5.4.1 on adoptOpenJDK11 in a windows 10 machine.
Could not get resource 'https://jcenter.bintray.com/com/marklogic/marklogic-xcc/9.0.2/marklogic-xcc-9.0.2.jar'
The location https://jcenter.bintray.com/com/marklogic/marklogic-xcc/9.0.2/ does not contain the requested jar marklogic-xcc-9.0.2.jar. Make sure to point to a valid maven repository containing that jar.
The root cause of your error is that a dependency is missing in the build.gradle.
My Spring framework MVC version is:
MarkLogic Java API 5.3.0
JDK 11
Spring Framework 5.2.7
Spring Batch 4.2.4
If you clone the whole project and have not upgraded any dependencies:
Add line 24 in the core:build.gradle
Load gradle change in IntelliJ and clean deploy the project.
Upon the successful gradle build, an App server (in my case, App name is ml-spring-batch # 7010) is scaffolded:
In IntelliJ, execute gradle task against samples ONLY. In cmd, run task: gradle runYourJob. Upon the gradle task completion, 100 documents are loaded in the content database.
I'm trying to get Google Cloud Vision API working with Java in IntelliJ. I've followed all the steps at https://cloud.google.com/vision/docs/quickstart-client-libraries. I'm running the following code, just trying to import the packages I need and when I scroll over google, it is underlined in red and says 'cannot resolve symbol google'. How do I fix this?
code and error
The error shown in your screenshot usually happens when an external dependency could not be loaded.
Please make sure you accurately followed the steps in the Install the Client Library section of the guide you followed, in the Java tab of the widget.
From the screenshot I can not really tell what build settings you configured for the IntelliJ project. If you chose no build tools or the regular Ant setup, it might be easier for you to re-setup a project based on either Maven or Gradle.
With Gradle and Maven it is pretty straightforward to add the dependency to the project as described in the guide, otherwise you will have to download all the dependency libraries yourself and add them to your project folder and build environment manually as files.
If you did already use Gradle or Maven for your project, and did follow the guide but it still shows the error, then it's usually a case of IntelliJ not loading those changes yet.
In that case you can fix it by selecting your Gradle or Maven tab in Intellij, and clicking the re-import button (looks like a refresh icon from browsers) to reload the configuration, usually triggering a download of missing dependencies.
Otherwise you can also trigger a full build with running the gradle build or mvn compile targets, which also should download all configured missing dependencies.
I have created an API using Ratpack and Groovy. All the GET, POST apps are working locally. Now I want this to move it to some remote server(say dev environment). How can I do this?
To start and run the app in local, I have to do either "gradle run" or "Run the Ratpack.groovy as a groovy script" from eclipse IDE. Then it says "Ratpack Server running in localhost:8080". And then I can use the APIs as localhost:8080/api/.../.../... but at the same time when I try to run it as JAVA Application, I am getting error as:
{"#timestamp":"2016-06-02T14:47:06.026+05:30","#version":1,"message":"Starting server...","logger_name":"ratpack.server.RatpackServer","thread_name":"main","level":"INFO","level_value":20000,"tags":null}
Exception in thread "main" java.io.UncheckedIOException: java.io.IOException: Is a directory
at ratpack.util.Exceptions.uncheck(Exceptions.java:52)
at ratpack.groovy.Groovy.ratpack(Groovy.java:112)
at ratpack.groovy.Groovy$ratpack.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:206)
at Ratpack.run(Ratpack.groovy:22)
To deploy it in prod, I moved the jar to the server. After that what should I do to start the Ratpack server or rather API service?
I would recommend setting up a CI pipeline that builds a java jar and deploys the artifact to your target environment.
I recommend using the Shadow Plugin from John Engleman https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow
This plugin produces a shadow jar (similar to Maven's shaded jar) that can optionally include bash scripts or batch scripts for starting your application.
High level suggestion:
Add the shadow plugin to your gradle build file
plugins {
id 'io.ratpack.ratpack-groovy' version '1.3.3'
id 'com.github.johnrengelman.shadow' version '1.2.3'
}
Have your CI server or you manually execute `gradlew installShadowApp
SCP/FTP this artifact from your build/installShadow directory to your target server
Invoke the shell script from build/installShadow/$appName/bin/$appName to start application
For a more maintainable solution I would recommend registering this shell script as a service or with a solution like monit/upstart/ etc
For a more detailed example on deploying to Heroku as an example take a look at my notes: http://danhyun.github.io/2016-gr8confeu-rapid-ratpack-groovy/#deploying_to_heroku
does anyone know how I can use the sqljdbc4 jar file inside a project but without setting it in the build path of the project inside Eclpise?
I store my project in a source control repository and have a Countinuous Integration Server (Jenkins) to run my java tests.
If the sqljdbc4 jar is included at Eclipse level only, the Countinuous Integration Server yells it cannot find the class specified (using Class.forName()) as the file is not "shipped" with my java code.
I also use Maven but it seems to not be provided by Maven repository as dependency.
Or any alternative I could use instead of sqljdbc4?
Thanks;
You may find this Using eclipse and maven 2, how to get dependancy for sqljdbc4? helpful as it shows you how to add sqljdbc4 as a dependency. You will have to do this on your CI server as well, unless you have a repository manager such as http://nexus.sonatype.org/, then you can install it there.