AEM cloud, how do you install groovy console? - aem

There is a groovy console for AEM:
https://github.com/CID15/aem-groovy-console
However, I dont know how to install it for AEM cloud.
The instructions say to download it and run a local installer, which will install groovy console some how on the local machine.
However, this wont help the other users of our project, and wont work when the project is built on the cloud envs.
Presumably, we need to configure mvn to automatically download and install it, or possibly we have to put some sort of lib file somewhere in our ame project source?
Any suggestions?

It's taken some effort to find a solution. Here we are installing the groovy console via the aem-easy-content-upgrade tool which uses it.
There are three files to edit:
pom.xml, all/pom.xml and filter.xml
pom.xml
<dependency>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu.complete.cloud</artifactId>
<type>zip</type>
<version>LATEST</version>
</dependency>
all/pom.xml
<embedded>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu.complete.cloud</artifactId>
<type>zip</type>
<target>/apps/aemlab-vendor-packages/install</target>
</embedded>
<dependency>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu.complete.cloud</artifactId>
<type>zip</type>
</dependency>
/all/src/main/content/META-INF/vault/filter.xml
<filter root="/apps/aemlab"/>
<filter root="/apps/aemlab-vendor-packages" />
Then rebuild with your usual 'mvn clean install -PautoInstallPackage' or similar.

Related

Use Maven Cargo to install Wildfly with Keycloak

I'm trying to use Maven Cargo to produce a Wildfly container and get Keycloak running on it. I've been at this for a while now and the way I see it there are two ways to go about it. I could either use an artifact installer for Wildfly and then try to deploy Keycloak to it, or I could use a zip installer and have it install Keycloak's appliance build. I have the basics of both solutions working although neither of them work all the way.
They both seem to have downsides. If you use the artifact installer you have a more stable installer, but deploying the war takes quite a bit of lower level configuration for Wildfly. (Deployment Instructions). On the other hand, the zip installer requires finding a place to download a distribution from and then manipulating it a bit before Cargo will recognize it, because the zip structure is not what Cargo seems to be expecting.
I'm getting the zip from here: https://repository.jboss.org/nexus/content/repositories/releases/org/keycloak/keycloak-appliance-dist-all/1.0.2.Final/keycloak-appliance-dist-all-1.0.2.Final.zip)
Thanks in advance guys.
I figured out a way to do this and attached the relevant pom snippet. The only oddball piece here ends up being the files section. It's being used to deploy a database file that has a couple test users, realms, apps, etc.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.6</version>
<configuration>
<container>
<containerId>wildfly8x</containerId>
<!-- <log>${basedir}/target/cargo.log</log> -->
<!-- <output>${basedir}/target/wildfly.log</output> -->
<home>${project.basedir}/target/cargo/installs/keycloak-appliance-dist-all-1.0.4.Final/keycloak-appliance-dist-all-1.0.4.Final/keycloak</home>
<artifactInstaller>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-appliance-dist-all</artifactId>
<version>1.0.4.Final</version>
</artifactInstaller>
</container>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.servlet.users>root:root:ManagementRealm</cargo.servlet.users>
<cargo.jboss.configuration>standalone</cargo.jboss.configuration>
</properties>
<files>
<file>
<file>${project.basedir}/WildflyKeycoakConfigs/keycloak.h2.db</file>
<todir>/data</todir>
</file>
</files>
</configuration>
</configuration>
</plugin>

Force unpacking with maven-dependency-plugin

Im am using Maven 3.2.1 with Eclipse Kepler. I have a dynamic web project which has a dependency to another component which includes some JSPs. I now want the JSPs from the dependency to become part of the web root of the dynamic web project. I chose to accomplish this by using unpack goal of the maven-dependency-plugin.
I added a plugin definition to unpack the JARs into /target/m2e-wtp/web-resources. Unfortunatley Eclipse from time to time cleans this folder and teh JSPs are gone. In order to unpack them again I have to delete the target/dependency-maven-plugin-markersfolder. Otherwise the plugin will not unpack the files again.
Is it possible to force the unpacking and ignore the plugin markers?
Is there a better way to get web resources from a dependency into my Dynamic Web Project?
Yes there's a better way, but it's not compatible with Tomcat's "serve module without publishing" feature (or Weblogic's equivalent thing)
Remove your maven-dependency-plugin configuration and add your dependency as a war overlay instead. If your dependency is a war, it'll be automatically recognized as an overlay (http://maven.apache.org/plugins/maven-war-plugin/overlays.html). If it's a zip or a jar, you need to add a specific configuration to your maven-war-plugin definition. Something along :
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<overlays>
<overlay>
<!-- /!\ must also be added as a project dependency-->
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<type>jar</type>
<targetPath>relative/path/to/contextroot</targetPath>
</overlay>
</overlays>
</configuration>
</plugin>
Before deployment, resources will be unzipped under target/m2e-wtp/overlays/bar-version.jar/ and then deployed onto your application server

Eclipse on-click deploy to remote Tomcat

I've been looking for this all-over the internet and somehow I can't find a easy way to do it.
What I need is really simple and I believe that many of you probably do it already:
- I develop Java Web Apps in Eclipse and so does my team;
- we have a tomcat7 server running on a Ubuntu machine which works as a centralized Dev environment;
- I would like to click a deploy button and send the new data to the server and deploy it (reload it), instead of exporting a war every time and manually upload it to server.
Up till now seems like the only way to do it is with Maven plugin for eclipse, which uses the manager/HTML interface of tomcat.
Problem: I just can't get it to work. But somehow I can't find a simple walk through that explains how to do it. I'm not too experienced with eclipse or Linux but the configuration of local tomcat servers seems pretty straightforward. I don't understand why is so hard to install a remote one.
Could you please help me out by explaining in detail how to do it? Thank you in advance for you patience.
Yes, you can use Tomcat7 Maven Plugin. Here is the steps:
1) Install Maven Integration for Eclipse (m2eclipse) to your eclipse from Eclipse Marketplace etc.
1.1) Navigate to Help -> Eclipse Marketplace and search "Maven Integration for Eclipse".
2) From eclipse, create a maven project.
2.1) Navigate to File -> New -> Project... -> Maven -> Maven Project.
2.2) Click Next (Leave all fields with default).
2.3) Select "maven-archetype-webapp" and click Next.
2.4) Enter arbitrary value on Group Id and Artifact Id. (e.g. "org.myorg" for Groupd Id and "myapp" for Artifact Id) and click Finish. (You will see pom.xml in your project's root.)
3) Edit pom.xml like this: (Replace yourhost below with your hostname or ip address.)
<project ...>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://yourhost:8080/manager/text</url>
</configuration>
</plugin>
</plugins>
</build>
</project>
4) Add following lines to your CATALINA_BASE/conf/tomcat-users.xml and restart your tomcat.
<tomcat-users>
...
<role rolename="manager-script"/>
<user username="admin" password="" roles="manager-script"/>
</tomcat-users>
5) From eclipse, run tomcat7:redeploy goal.
5.1) Right click your project and navigate to Run As -> "Maven build...".
5.2) Enter tomcat7:redeploy to Goals and click Run.
6) Once you create the run configuration setting above, you can run tomcat7:redeploy goal from Run -> Run Configurations.
Please refer to the following documents for details:
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Configuring_Manager_Application_Access
http://tomcat.apache.org/maven-plugin-2.1/index.html
http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/plugin-info.html
If you use another user instead of admin with empty password (which is plug-in's default), you need to create %USERPROFILE%.m2\settings.xml and edit pom.xml like below:
%USERPROFILE%.m2\settings.xml:
<settings>
<servers>
<server>
<id>tomcat7</id>
<username>tomcat</username>
<password>tomcat</password>
</server>
</servers>
</settings>
%USERPROFILE% is your home folder. (e.g. C:\Users\yourusername)
pom.xml:
<configuration>
<server>tomcat7</server>
<url>http://localhost:8080/manager/text</url>
</configuration>
Add server tag.

Integrating SmartGWT in Gerrit (Maven project)

I want to add some feature to this project and I need smartgwt for all those fancy UI stuff. I modified the pom.xml to add the dependencies (smartgwt2.4 and skins).
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt-skins</artifactId>
<version>2.4</version>
</dependency>
And inherits smartgwt to my project.gwt.xml ... So far so good, I add the new ui and implemented my stuff. Works geat on hosted mode/debug, etc...
But when I do a mvn clean install, my build is a great success. But when I try to load the daemon and check my application locally I get stuck on the hosted.html... So basically, I get stuck on the loading page..
I was wondering if that as to do with conflicting package between smartgwt and the current gwt in the project. Anyone has worked with gerrit or any similar application before that could help me out. And the great thing about this, I have no error to display...
It is not about your smartgwt dependency. I think there are missing files which are stopping your module from loading. It used to happen to me. I would advise you to add some SC.say("I'm here") at the start of your entry point to see if it is reaching this far. Also, check the server logs for any errors.
EDIT :
I would have to guess that the problem is in your empty web.xml. You should at least define a servlet-mapping

In Maven: how to attach sources to tools.jar

I have to use libraries in tools.jar and have therefor added this dependency:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
Now I would like to attach the sources in Eclipse, so I see what I develop against.
I guess nothing will be available in the standard maven repositories (I can't even find anything in download.java.net/com/sun).
I know there is a source archive available, but it contains everything and I would at least need to know what parts of it need to go in the source jar.
Has someone done this? Is there a tools-sources.jar available somewhere? Or can you tell me what parts of the jdk sources I need?
Here's what I did. I downloaded the source archive from openjdk, extracted it and manually linked the jar source to
External Folder -> [unpacked archive basedir]/langtools/src/share/classes
This is not a maven solution, it's eclipse only, but it works.