App Engine Maven Plugin - maven

What is the difference between com.google.appengine and com.google.cloud.tools
eg.
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.62</version>
</plugin>
and
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.1</version>
<configuration>
<stage.enableJarSplitting>true</stage.enableJarSplitting>
<deploy.stopPreviousVersion>true</deploy.stopPreviousVersion>
<cloudSdkPath>/usr/foo/path/to/cloudsdk</cloudSdkPath>
</configuration>
</plugin>
</plugins>

com.google.appengine -> Was designed specifically for the App Engine structure (Older version). This is based on the App Engine SDK.
com.google.cloud.tools -> This is the new Google Cloud SDK-based plugin. This allows to use libraries outside of the App Engine environment. The Cloud SDK is also a set of command line tools (gcloud, gsutil, and bq).
As long as your work would be contained in the App Engine environment you can pick either of them, as you prefer. You could check more on the differences in Migrating to the Cloud SDK-based Maven plugin

Related

Migrating AppEngine application to Java 11 runtime - [http://java.sun.com/jsp/jstl/core] cannot be resolved

So I have an AppEngine application that I'm working on migrating to the Java 11 runtime, and am using the appengine-simple-jetty-main artifact, as outlined in https://cloud.google.com/appengine/docs/standard/java-gen2/war-packaging, to replace the built-in Jetty server of the old Java 8 runtime.
Now if I use mvn jetty:run to bring up my application locally, everything works fine. But when I try to run the appengine-simple-jetty-main wrapper via mvn exec:java -Dexec.args="<my application directory>/target/<application>.war", I hit an issue.
The server starts up fine, and executes various ServletContextListeners that use outside dependencies declared in my pom.xml. I'm also able to navigate to static HTML. When I try to navigate to a JSP Servlet, however, I'm getting the error
HTTP ERROR 500 org.apache.jasper.JasperException: The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application
And likewise, I get this same error when I actually deploy to AppEngine.
As mentioned before, this works just fine when I bypass appengine-simple-jetty-main wrapper using mvn jetty:run, and my pom.xml includes the dependency
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>2.0.0</version>
</dependency>
My build section looks like
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>11.0.11</version>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<deploy.projectId>contra-program</deploy.projectId>
<deploy.version>GCLOUD_CONFIG</deploy.version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/appengine-staging</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
So I'm a bit flummoxed. Other maven dependencies seem to be getting brought in just fine. It's only the JSTL library that's having issues (so far, at least), and even then, only when I use the appengine-simple-jetty-main wrapper.
The nearest existing question I could find was cannot load JSTL taglib within embedded Jetty server, but I haven't had luck with the provided solutions (though I'm more than happy to admit the possibility that I'm just not applying one or more of them correctly).
Any pointers would be greatly appreciated :-)

Google Cloud SDK App-Engine project priority

To deploy my app I use this in bash:
mvn appengine:deploy -Dproject=projectname1
This is my pom.xml:
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.1</version>
<configuration>
<project>projectname2</project>
</configuration>
</plugin>
</plugins>
</build>
At the moment, my app is deployed in projectname2 while I want it to ignore pom's project configuration and give priority on the sh one.
I red the Cloud SDK documentation but I didn't notice how to do.
I need this to choose where Jenkins will deploy the app on, regardless the pom's plugin setting.

Mule API Kit not available on 3.6.1 CE server?

I have a Mule project which makes use of a REST API Via the Mule Apikit.
When I run the project as a 'Mule Application' from eclipse there are no issues.
when I run the project as a 'Mule Application with Maven' the application builds but on startup of the mule server i see errors relating to resolution of the apikit schema and later namespace within my flows. ( I see the same thing when I load the application to a standalone Mule server.
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
I have two entries in my .pom file related to apikit.
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit</artifactId>
<version>1.6.1</version>
</dependency>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit</artifactId>
</inclusion>
</inclusions>
</configuration>
</plugin>
By default the Mule Maven plugin excludes all Mule dependencies, regardless of their scopes.
You need to forcefully include the APIkit dependency with:
<configuration>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit</artifactId>
</inclusion>
</inclusions>
</configuration>
Reference: https://github.com/mulesoft/maven-mule-plugin/tree/maven-mule-plugin-1.9#managing-dependencies
This plugin seems to be the culprit:
<plugin>
<groupId>org.mule.tools</groupId>
<artifactId>maven-mule-plugin</artifactId>
<version>1.9</version>
<extensions>true</extensions>
</plugin>
When it is present the lib directory in the resulting zip is not populated, when it is removed the apikit (and other libraries) are present.
There are side effects to this however, This plugin seems to allow recognition of flow xml files in subfolders of the /app/ directory (which my project was using). Also adding/removing the dependancy seems to impact on the eclipse project ( I've seen it remove all of my src folders and replace them with a single /src/).

Including third party AMP in main project in Alfresco Maven SDK, especially WCMQS

This is the scenario, I have a group of a AMPs, some developed by myself, and other developed by other developer/vendors.
If I am not wrong, using the Maven SDK I can develop and run only one specific AMP at a time.
What steps can be taken to have an external AMP being deployed along with the main project AMP at start up which is when running mvn integration-test -Pamp-to-war.
In particular I am interested in having Alfresco load the wcmqs module.
Assuming you already have the external amps available to maven (either because their're on Maven Central repo or because they're installed locally), you simply add the external amps as dependencies in your amp project. E.g.:
<dependency>
<groupId>org.sharextras</groupId>
<artifactId>javascript-console-repo</artifactId>
<version>0.6.0</version>
<type>amp</type>
</dependency>
You also must configure the maven dependency plugin. You can do it in a profile so it can be turned on or off depending on your needs:
<profiles>
<profile>
<id>unpack-deps</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-amps</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeTypes>amp</includeTypes>
<outputDirectory>${alfresco.client.war.folder}</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
This way, you can start the main project amp plus its dependencies with the following command:
mvn integration-test -Pamp-to-war -Punpack-deps
For a complete pom.xml example see: https://github.com/douglascrp/alfresco-value-assistance/blob/master/alfresco-value-assistance-repo/pom.xml

using QueryDSL in osgi

I have been trying to use querydsl in a project which is an osgi bundle.
my pom.xml has the following dependencies:
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>2.5.0</version>
</dependency>
As well as the plugin
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>0.3.2</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<!-- | the following instructions build a simple set of public/private
classes into an OSGi bundle -->
<configuration>
<instructions>
<Import-Package>com.mysema.query.jpa,*</Import-Package>
<Export-Package>com.mypackage.package.*;version="${project.version}"</Export-Package>
</instructions>
</configuration>
</plugin>
Still when I try to start the bundle I get:
Error executing command: Unresolved constraint in bundle com.mypackage.package [163]: Unable to resolve 163.0: missing requirement [163.0] package; (&(package=com.mysema.query.jpa)(version>=2.5.0)(!(version>=3.0.0)))
I was using an older version of querydsl but apparently they fixed some stuff about osgi recently so I upgraded. The problem persists.
What I am missing for querydsl to work inside osgi?
Installing each dependency by hand will be a pain, but AFAIK there's nothing that will take a maven artifact and chain back of all dependencies - this would fail as where would it stop?
You could end up with every version of every logging framework (even if you had pax-logging installed), or the wrong implementation.
Alas in maven's case there's currently no way of applying semantic versioning or higher level requirement and capability. (Though BND (maven-bundle-plugin, bndtools) makes some sensible assumptions at a code level)
Karaf features (see the PDF manual in distribution's ${KARAF_HOME}) can do a lot to alleviate this but it can take some work to setup. There's a(t least) couple of ways to generate features files;
Use the features-maven-plugin
Use the maven-build-helper plugin to publish an XML file that you handcraft (laborious but you can maintain versions using resource filtering).

Resources