We have some custom repository which contains different builds (set of osgi bundles). There are any Geronimo 3 remote servers. I should by a command get some build from repository and make hot deploy to a set of stands. It maybe existing tool or java api. As I know Cargo don't work with remote Geronimo. I will be grateful for any suggestion.
Geronimo 3 is based on apache karaf. So the mechanisms provided by karaf may be of help.
Connect to the ssh console and use commands like bundle:install or feature:install
Use the remote JMX port and the MBeans provided there. Again you have the choice between installing bundles or features
In both cases bundles and features can be refered with http or mvn uri. I personally normally use the mvn uris that karaf also uses internally.
So the process is to first build your bundles/features to a maven repository and then trigger the install command and access the mvn repo you deployed to.
You can add you own maven repo in the etc/org.ops4j.pax.url.cfg.
Related
How to see what an installed Karaf feature have inside?
Does it have other features in it?
What bundles and with what start-level does it install?
I talking about features like cxf of http.
You can use the command:
feature:info <featurename>
to get details about the feature. It shows dependent features, bundle and config for this feature.
If you want even more details you can check the feature repos:
feature:repo-list
Each install feature repo will be shown with a mvn uri.
For example for cxf 3.2.5 you would see.
cxf-3.2.5 mvn:org.apache.cxf.karaf/apache-cxf/3.2.5/xml/features
Karaf can directly display the content of these urls
cat mvn:org.apache.cxf.karaf/apache-cxf/3.2.5/xml/features
This will display the xml of the cxf feature. You can also find this directly in the maven central repo.
If a feature does strange things during its installation then there is also a way to debug:
feature:install -v http
This will install the karaf http feature and on the way log in detail what is done. Like bundles being deinstalled, installed, refreshed, restart, configs being deployed. This helps a lot when things do not go like expected.
Is it possible/ how do you take an packaged version of a jar via a repository (for example Artifactory) and deploy it to an instance of AEM?
Could this be done via Maven and Jenkins in an automated way?
Currently this is done, only by using a tagged version in a VCS to build and then deploy via the content-package-maven-plugin.
With Jenkins you have multiple options:
You could let Maven build the artifacts for you
or you could use the Repository Connector Plugin (1) to get the artifacts from Nexus / Artifactory
After that, just use the CRX Content Package Deployer Plugin (2) to upload the packages to your AEM instance.
The Jenkins build could be triggered manually, by change in the VCS,...
(1): https://wiki.jenkins-ci.org/display/JENKINS/Repository+Connector+Plugin
(2): https://wiki.jenkins-ci.org/display/JENKINS/CRX+Content+Package+Deployer+Plugin
IBM Liberty documentation claims that it is possible to start/stop/manage Liberty server using SPI directly from the code. I'd like to use such functionality to create integration tests for my REST services.
Reference on original article:
http://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_extend_embed.html?lang=en
I want to create integration test that:
1) Start Liberty server with my own 'server.xml'. I want to provide specific DataSource and security here.
2) Deploy an EAR application on Liberty server.
3) Run REST-Assured tests on Liberty server.
4) Undeploy application and shutdown Liberty server.
Basically I stuck on 1st stage - I can't start server because I am getting 'NoClassDefFoundError: com.ibm.ws.kernel.boot.EmbeddedServerImpl' exception. The link above describes that 'ws-server.jar' from Liberty installation must be used, but what about referencing it from maven dependencies? I suppose that I could specify some artifact from IBM maven repo 'https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/' and use it to start Liberty as embedded server directly from my unit tests, but I can't find what that artifact should be.
So, to rephrase myself: what would be maven artifact in IBM's repository that contains EmbeddedServerImpl class? And is it enough to include that artifact or there are more of them required for liberty embedding?
You can't reference it from the Maven repository because it must be part of the Liberty installation that you want to start as it uses it's location to work out what it is starting.
I wrote an article and sample a little while ago outlining different techniques for writing functional/integration tests against Liberty including using a JUnit Rule with the Embedded Server starting and stopping the server:
https://developer.ibm.com/wasdev/docs/writing-functional-tests-liberty/
https://github.com/WASdev/sample.functionaltest
This was using Gradle to do the build script part so I included the launch JAR with:
fvtRuleCompile fileTree(dir: "${libertyRoot}/bin/tools", include: 'ws-server.jar')
The same can be achieved in a Maven build environment by using a System Dependency:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies
I don't think the ws-server.jar is provided in the IBM Maven DHE repository, only Liberty API's and SPI's and some packaged runtimes are provided to the user as Maven dependencies.
By the way, if you're using artifacts from the IBM Maven DHE repository, you may want to change them for the ones that are now provided in Maven Central, see:
http://mvnrepository.com/artifact/com.ibm.websphere.appserver
For a GWT application which I build with the GWT Maven Plugin (gwt-maven-plugin), I can run the GWT Development environment with
mvn compile war:exploded gwt:run
and then launch a browser. This requires that the browser provides the GWT Developer Plugin. (Firefox 6 for example does not yet support the GWT Plugin).
Does the GWT Maven Plugin also allow to simply run the included Jetty container with the GWT application, without a development mode?
After configuring gwt-maven plugin you could simply run the following.
mvn jetty:run-war
After gwt compilation the resulting war will be placed in jetty and started via Maven Jetty Plugin.
The only way to run the project without plugin is to compile it and run on a server. If you are using Netbeans just hit run. The IDE will compile and deploy project on a server. In other way just compile it with the following command (you can omit tests and reports):
mvn clean:clean resources:resources compiler:compile war:exploded resources:testResources compiler:testCompile surefire:test gwt:compile war:war
After this you 've got ready to deploy war file. To deploy it to the Glassfish there are now basically three options:
Maven GlassFish Plugin
A first option would be to use the Maven GlassFish Plugin. This plugin allows to interact with a local or remote GlassFish install and the management of Glassfish domains and component deployments from within the Maven build lifecycle.
Maven Embedded GlassFish Plugin
The second option would be to use the Maven Embedded Glassfish Plugin. As stated by its name, this plugin doesn't rely on an existing install but uses an embedded GlassFish, running in the same JVM as the plugin. This plugin is extremely nice if you want to keep your build portable (anybody can get your POM and run a build involving GlassFish without having it installed) with almost the same features as a normal GlassFish install, except clustering of course (you can use a preconfigured domain.xml if you want). See Testing with the GlassFish Maven plugin and JavaDB Embedded for an example.
Maven Cargo Plugin
The work initiated by Kohsuke Kawagushi as been finally integrated in Cargo and, starting with Cargo 1.0.1, GlassFish 3.x is now supported. Using the Maven Cargo plugin is thus a third option. This would be interesting for builds that want to interact with containers in an agnostic way. But I'm not sure Cargo allows all the flexibility of the GlassFish specific plugin(s) (e.g. deployment of JMS resources, etc).
I've been trying to integrate deploying java .war's in GlassFish V3 through Maven. While I have found a few plugins, none of them look to be very active:
Maven Glassfish Plugin
Eskato's Wordpress Blog on Maven
And I got the most information out of Eskato's Blog, it was written March 2008, so I don't know what the state of GlassFish Maven integration is, nor can I find a suitable plugin to work with. With the Maven GlassFish Plugin I have had some success, but it still doesn't work entirely well for all goals it says it supports, which makes some of the commands ineffective.
Has anyone else been able to integrate Glassfish V3 and Maven successfully? If so, what resources did you use to get it done?
Update: CARGO-491 has been fixed and I've updated my answer accordingly. To summarize, there are now basically three options:
Maven GlassFish Plugin
A first option would be to use the Maven GlassFish Plugin. This plugin allows to interact with a local or remote GlassFish install and the management of Glassfish domains and component deployments from within the Maven build lifecycle.
Maven Embedded GlassFish Plugin
The second option would be to use the Maven Embedded Glassfish Plugin. As stated by its name, this plugin doesn't rely on an existing install but uses an embedded GlassFish, running in the same JVM as the plugin. This plugin is extremely nice if you want to keep your build portable (anybody can get your POM and run a build involving GlassFish without having it installed) with almost the same features as a normal GlassFish install, except clustering of course (you can use a preconfigured domain.xml if you want). See Testing with the GlassFish Maven plugin and JavaDB Embedded for an example.
Maven Cargo Plugin
The work initiated by Kohsuke Kawagushi as been finally integrated in Cargo and, starting with Cargo 1.0.1, GlassFish 3.x is now supported. Using the Maven Cargo plugin is thus a third option. This would be interesting for builds that want to interact with containers in an agnostic way. But I'm not sure Cargo allows all the flexibility of the GlassFish specific plugin(s) (e.g. deployment of JMS resources, etc).
maven-glassfish-plugin and maven-embedded-glassfish-plugin both have their pros and cons. The main difference is that the latter works with an Embedded Glassfish instance, as indicated by its name, i.e. the server is running in the same VM as the plugin.
So you cannot use maven-embedded-glassfish-plugin to deploy your WAR to a standalone Glassfish server, you need maven-glassfish-plugin to do that.
The main problem I had with the maven-glassfish-plugin is the fact that its interaction with the Glassfish server is stateful - I could not find a way to use it such that my WAR would get deployed to the server in any case, no matter whether the previous build succeeded or not.
glassfish:deploy does not work if the WAR is deployed already. glassfish:redeploy does not work if the WAR is not deployed. And Maven has no if-else logic...
I've blogged about how to configure Maven Embedded GlassFish plugin to work correctly with GlassFish 4.0 until there's a new release of that plugin.
https://blogs.oracle.com/brunoborges/entry/glassfish_4_beta_and_maven
Also, it is possible to configure a datasource in the glassfish-resources.xml and have it working correctly.
https://blogs.oracle.com/brunoborges/entry/configure_datasources_for_maven_embedded
These are useful tips to anyone that want to run Java EE 7 projects with Maven and GlassFish 4
You can use this one :
http://www.hascode.com/2011/09/java-ee-6-development-using-the-maven-embedded-glassfish-plugin/
https://github.com/andrzejsliwa/glassfish-maven-plugin/wiki
http://cargo.codehaus.org/Maven2+plugin
I use the glassfish plugin on maven-glassfish-plugin.dev.java.net and did some code changes to support v3 now. I requested committer status and wait for acknowledgement. Hopefully I can commit my changes.