APIs for maven dependency - maven-plugin

Are there any API that helps to find dependency of maven packages.
I used the examples present in the answer of Programmatically resolving Maven dependencies outside of a plugin - get RepositorySystemSession and RepositorySystem
However the dependency list that I get using aether is different from the list given by APIs
AFAIK. The API did not resolve ranges, I am not sure whether it handles exclusions.
Is there any readily available API that takes care of resolving version ranges, exclusions (simillar to what i get when using "mvn dependency-list/tree)
I am looking for API that exactly returns result provided by mvn dependency:list/tree
Note: My code is running outside mvn plugin

I recommend to use two tools:
mvn help:effective-pom
This tool provides effective pom - the very detailed pom.xml with all actual dependencies and versions
mvn dependency:tree
Provides the dependency tree

Related

[Apache Flink]: Where is flink-s3-fs-hadoop plugin?

I would like to read and write some data with Apache Flink 1.11.2 from S3. The documentation recommends to use the presto plugin for checkpoints and the hadoop plugin for pipeline data.
After reading this section you have to copy the plugins from /opt to /plugin. I can find the flink-s3-fs-presto-1.11.2.jar under /opt but there is no flink-s3-fs-hadoop-1.11.2.jar. Where can i find the s3-hadoop plugin for setting up my production environment?
And how can i use these plugins in the IDE? Simply adding these to pom.xml als provided dependencies? And then how can i pass the crentials in IDE?
That is weird I can see that they are both present in the official binaries in opt in 1.11.1. However if You can't find them, You can simply try to get the jars from Maven here and copy them to the required place. Another thing that may work is adding the dependency into the project with compile scope.
Running the job locally is described here. There are various ways of configuring the credentials when running the job in IDE, one might be adding core-site.xml to resources folder with proper configruation.
EDIT:
As for the local execution it was explained here a little bit.

Angular & Webpack Dependency Versioning

Recently I've been running into an issue and I'm not sure how to best resolve it. We have a very modular architecture on the front end. We write individual angular components, put them in different repo's, and then include them in other apps as they are required, built with webpack & included via NPM.
Recently I've run into issues where multiple versions of a module end up in the compiled /dist folder coming from different places such as:
Directly included in the App I'm working on
2x Indirectly included through a module that I included (see chart for details).
The reason different versions could be used is that at the time CodeA is written ModuleA may be at version 1, then at a later date CodeB is written which also uses ModuleA which is now at version 2.
Then CodeA and CodeB are included in CodeC and now you have a module name collision on ModuleA.
With this setup, I believe if the multiple modules by the same name are loaded, the last one to get loaded is going to be the code behind that module name. Meaning it will be the one to be used by all modules. So there's no guarantee that the most up-to-date version is will be used. This usually results in getting an error that a method on ModuleA by name XXX does not exist.
To make sure I'm running the latest version of the module I have to go in and manually update (npm install) and build with webpack (npm run build) each library and then push them all to Github. Then I have to npm install in my root app. This isn't always an easy thing to do as the individual libraries' code may need updated to use the latest version of the module in question.
I'm looking for a solution to this issue. I'm guessing a structural/organizational change that will help us to not get into this predicament. If you have any solutions/advice/articles I need to check out please share. Thanks!

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.

Resources