Google Cloud SDK App-Engine project priority - maven

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.

Related

App Engine Maven Plugin

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

using spring-boot-maven-plugin with exec classifier, but can't run the app from IDE anymore

I am working on Spring Boot 1.5.9 application, and I am generating a jar that contains a Spring Boot application, but that can also be imported as part of another project.
Therefore, I am using below config to generate 2 jars : the exec, and the regular lib ones.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
However, now that I have this, I am not able to run the application from my IDE (Intellij) anymore, as it's not finding the application.yml.
I am sure there's a trick, but I can't find anything.. Any idea ?
I ended up using Maven profiles :
<profiles>
<profile>
<id>makeRelease</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
When I make the release, I am calling this profile (maven with argument -P makeRelease) so that it generates the 2 jars.
The rest of the time, the regular behavior applies.

Deploy Java EE Wildfly REST Application to Openshift

I am new to Openshift and having trouble with deploying my Java EE project to it. I have made REST API for a simple webstore. Locally it works fine on Wildfly 9.0.2 I want to deploy it on openshift. I 've made new wildfly9 + mysql5.5 application using eclipse openshit jboss plugin and added a profile to root pom.xml:
<profiles>
<profile>
<id>openshift</id>
<build>
<finalName>webstore</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<outputDirectory>deployments</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
My root project consist of several maven modules including store-ear (EAR), store-jpa (JAR), store-rest (WAR), store-web (WAR), store-services (EJB), store-rest-interfaces (JAR),store-service-interfaces (JAR).
I have changed datasourse in JPA configuration (persistence.xml) to use MysqlDB on Openshift.
After pushing back to openshift the build is succesfull, but when it gets deployed it is missing some dependancies (ClassNotFoundException), and fails to deploy main war file.
You use a maven-war plugin in your openshift maven profile.
But you say that your project is packaged as en ear. So you should probably deploy this ear which contains all your project modules (wars, ejbs, libs...) instead of a specific war of your project.
To achieve this, you have to use a maven-ear plugin instead of the maven-war one in your openshift profile which would look like this:
<profile>
<id>openshift</id>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>

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

change deployed artifact name based on profile

I have in a web application's pom file, a build profile, which does some necessary things (in my code) for qa testing.
I have this code on svn and this code is compiled in Hudson, which deploys artifacts in nexus..
Hudson has two jobs, one for qa profile (-P qa) and one for customers.
What i need is that i change in my qa profile the artifact's name during deploy phase, so that nexus has two different war files, one for qa and one for customer.
I use (after Google search) the following which looks like it does nothing in hudshon!
<profile>
<id>qa</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
<configuration>
<classifier>qa</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
any ideas someone?
You actually need to set the "classifier" configuration option on the plugin that's building the package that's being deployed: maven-(ear|ejb|jar|rar|war|shade)-plugin:
For instance, to build a WAR with a qa classifier, you would do the following:
<profile>
<id>qa</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<classifier>qa</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Also, instead of setting the classifier you could set any of the following (most default to project.build.finalName, so setting that property updates many of these):
General
project.build.finalName
War Plugin
warName
Ear|Jar|Rar|Shade Plugin
finalName
EJB Plugin
jarName
One final note: I never realized this before, but looking over the documentation, it looks like the RAR plugin doesn't support the "classification" option. Shade does support the classifier concept, but does it via the "shadedClassifierName" property.

Resources