Dependency management with Heroku Java web apps - java

I'm new to web apps, the play framework, heroku and dependency management.
I've created a new Heroku Play framework based Java web app and I'm trying to install the dependencies for auth0 (https://addons.heroku.com/auth0#dev).
The auth0 documentation (https://docs.auth0.com/#!/web/java) only documents how to add a dependency with Maven.
There is no "pom.xml" file within the Heroku app files as I think is normally the case with Maven in a Java app. What really confuses me, is that in some areas on the Heroku documentation, it states that Maven is used by default for Java web apps, in other areas SBT, then within the project files there is a dependencies.yml file (under the conf directory).
I'm really confused as to how dependencies in Heroku Play Java web apps are managed (if its Maven by default then where's the pom.xml file?) and how I add the dependencies for auth0 and some other .Jar files (like JSOUP). There is very little documentation or examples on the dependencies.yml file, whether it's supposed to replace/supplement something like Maven or SBT, or how to add to it.
Does anyone know what the deal is with dependency management in Heroku?

Related

Cannot add application insights bare api to java web application

I added all the jar files of application insight sdk for java in java web project and included the code for sending custom telemetry in servlet but when i try to run the servlet it shows classnotfound error for TelemetryConfiguration and TelemetryClient.
Per my experience, I think you can try to check the jar files of Application Insight SDK for Java whether be added the Libraries of Java Build Path, please right click the prject name and select the Properties in the menu.
If using Maven project, you can see the jar files in the Maven Dependencies.
If using the normal Dynamic Web Project, you can see them in the Web App Libraries or a User Library with custom name.
Then you need to try to manually build the project, and run the servlet again.
It seems that you added only the web library without the core library, which contains the TelemetryClient class.
You can read the Application Insights Java SDK article which describes in details how to add the Java SDK to your web project, whether you're using Maven or Gradle as your build system, or manually downloading and referencing the libraries.

how to create gwt gae with app engine modules using google eclipse plugin

How to create a new GWT and GAE project with modules using google eclipse plugin in Java? I tried using make a new web applications from the eclipse, but it just create me a GWT and GAE project without modules.
Thanks.
You'll probably want to first create a WTP project using GPE, because to use modules you'll need to create an EAR project. This is described here:
https://developers.google.com/appengine/docs/java/webtoolsplatform
You'll create modules, which will each be a dynamic web project. Your GWT app will be one of those. And follow the instructions for modules here:
https://developers.google.com/appengine/docs/java/modules/
Note that there will be two Google related items when you right-click your project: Google and Google App Engine WTP. Commands related to app engine in the Google menu don't seem to work. Instead use the app engine related commands in the Google App Engine WTP menu.
Apparently, it is an open feature request to do this programmatically:
https://code.google.com/p/google-web-toolkit/issues/detail?id=3584
and
https://code.google.com/p/google-plugin-for-eclipse/issues/detail?id=121
There is a proposed workaround:
GWT Compile and copy the /war/ output into a standard Dynamic Web Project.
I have tested this workaround and it works. Simply copy the Google Web Applications Project's "war" directory into the web content directory (default: "WebContent") of a stub Dynamic Web Project.
For the local AppEngine dev server for Dynamic Web Projects and EAR projects it is important that project names do not contain a space. Moreover, this also applies to the AppEngine agent file path, see Error opening zip file or JAR manifest missing : C:\Program.
How to create a new GWT and GAE project with modules using google eclipse plugin in Java?
Do check in each option to create project with sample code.
Use Google Web Toolkit
User Google App Engine
Sample Code : It creates sample code with module as you expect.

Runtime dependencies for GAE web app

After downloading the GAE SDK (1.7.1) I have a massive amount of JARs under my ${GAE_HOME}/lib/ directory:
I am in the process of setting up a build for my GAE web app on my local machine but also plan on setting up a QA machine. I'm also using an Ivy repository hosted on a 3rd server for resolving all of my web app's dependencies.
I need to know which GAE JARs I will need to package under my web app's WEB-INF/lib directory, and which ones are available to my web app at runtime on both the dev appserver as well as my live/production GAE servers.
So I ask: does the production environment of GAE make all these JARs available at runtime, or do I need to package them in my WAR? And do production GAE servers make the same dependencies available as the dev appserver, or do I need to have different dependency configurations for dev and production environments? Thanks in advance!
Please note: I am using the Google-Eclipse plugin for a few features, but not building or uploading/deployment. I'm setting up an external Ant build that calls Ivy and other tasks that I am running from a terminal. So I'm not interested in any build-related features of the plugin!

Maven and autobuilding other Eclipse projects to your web application

I have made my own frameworks, and I use these frameworks in my web applications. Now I have to create JAR file for my project and then copy this jar to web application lib path. Is it possible to make Maven do this for me.
(Currently I don't use Maven, because I didn't get it to work with GAE.)
Yes of course, this is possible, any build tool can do that (even a shell script).
So in maven, you define a module for your framework. You define another module for your webapp, configured as a web app, add a dependency between them. This dependancy is enough for maven to understand that your framework module jar must be included in the web application.
Here a quick introduction to maven : http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
And here a basic config file for web apps : http://maven.apache.org/guides/mini/guide-webapp.html
You can create a maven project for your framework and another one for your web application. Then you just add your framework project as a dependency to your web application and it is automatically copied to lib path.
Generate a project for your framework:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart
Generate a project for your web application:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
edit pom.xml of web application and add your framework as a dependency

Building a Java EE 6 project, with a swing client using Maven

I am trying to recreate an existing project with Maven (any IDE is ok, but mainly Netbeans), and I'm a bit confused about the best way to do this, so any help is greatly appreciated.
Currently I have an Enterprise application with the following components:
Web application (some jsps, servlets).
Ejb project
Client project (Swing application / applet)
Common project (Contains common files used by the applet and the Web app).
The problem is the packaging and dependencies, currently the Client (Applet) jar is packaged within the Web application, so that when the web app is deployed, the users can access the applet via their browser.
Is there any similar existing archetype for this, or does it require heavy customization ?
Oh, and I am using Glassfish 3.1
Thanks in advance.
So first of all, for me it looks like you need multi module maven project. In that case there will be no single archetype that will fulfill your needs.
When it comes to "the Client (Applet) jar is packaged within the Web application" you can use maven-dependency-plugin (http://maven.apache.org/plugins/maven-dependency-plugin/) and its goal:
dependency:copy - takes a list of artifacts defined in the plugin configuration section and copies them to a specified location, renaming them or stripping the version if desired. This goal can resolve the artifacts from remote repositories if they don't exist in local.

Categories

Resources