martes, 3 de noviembre de 2015

Trying "Continuous Enterprise Development in Java" using Forge 2

Book: Continuous Enterprise Development in Java - Testable Solutions with Arquillian (1st Edition)

Environment:
  • JBoss Developer Studio 9.0.0.GA (Forge 2.19.2.Final - embedded)
Commands:

Forge 1: set ACCEPT_DEFAULTS true;
Forge 2: ?

Forge 1: new-project --named feedback --topLevelPackage org.x --projectFolder feedback;
Forge 2: project-new --named feedback --topLevelPackage org.x;

Forge 1: persistence setup --provider HIBERNATE --container JBOSS_AS7;
Forge 2: jpa-setup --provider Hibernate --container JBOSS_AS7;

Forge 1: validation setup --provider HIBERNATE_VALIDATOR
Forge 2: (automatically done on first constraint-add?)

Forge 1: entity --named FeedbackEntry;
Forge 2: jpa-new-entity --named X;

Forge 1: field string --named x;
Forge 2: jpa-new-field --type String --named x;

Forge 1: constraint NotNull --onProperty x;
Forge 2: constraint-add --constraint NotNull --onProperty x;

Forge 1: scaffold setup
Forge 2: scaffold-setup

Forge 1: scaffold from-entity org.x.*;
Forge 2: scaffold-generate --targets org.x.*;

Forge 1: forge install-plugin arquillian
Forge 2: addon-install-from-git --url https://github.com/forge/addon-arquillian.git --coordinate org.arquillian.forge:arquillian-addon (from here)

Forge 1: arquillian setup --containerType REMOTE --containerName JBOSS_AS_REMOTE_7.X --testframework
Forge 2: arquillian-setup (the command only accept two parameters: arquillianVersion and testFramework; the rest of information will be prompted in interactive mode) (Forge commands are contextual, so remember to cd to your app root or other convenient place to execute arquillian-setup; otherwise you may get "Command: arquillian-setup was not found")


Forge 1: arquillian create-test --class org.x.X.java
Forge 2: arquillian-create-test --targets org.x.X 

Forge 1: build --notest --profile arq-jboss_as_remote_7.x;
Forge 2: build --notest --profile arquillian-jbossas-remote-7; (build --profile doesn't support tab completions...neither build itself?)

Forge 1: forge install-plugin jboss-as-7
Forge 2: (from here)
  • addon-install-from-git --url https://github.com/forge/as-addon  --coordinate org.jboss.forge.addon:as
  • addon-install-from-git --url https://github.com/forge/jboss-as-addon  --coordinate org.jboss.forge.addon:jboss-as-as7

When I executed the last commands from the JBDS' Forge, I got the following error:

***ERROR*** Addon org.jboss.forge.addon:as,2.0.0-SNAPSHOT could not be installed: zip file closed

I had also a standalone Forge 2 (2.20.0.Final) installation. I ran the commands from there and the installation was succesful; the addons installed through that shell now appear in the addon-list of the JBDS' Forge:
  • org.jboss.forge.addon:as,2.0.0-SNAPSHOT
  • org.jboss.forge.addon:jboss-as-as7,2.0.0-SNAPSHOT
Forge 1: as7 setup
Forge 2: as-setup --server jbossas7

Forge 1: as7 start --jboss-home target/jboss-as-dist/jboss-as-7.1.1.Final/
Forge 2: as-start

JBoss Developer Studio 9.0.0.GA runs on Java 8 but JBoss AS 7 doesn't (needs Java 7). What happened to me was that JBoss AS 7 never started; it just hanged in the boot process, causing Forge to report an error after 90 seconds:

[jbds]$ cd feedback\
[feedback]$ as-start 
08:44:21,383 INFORMACIÓN [org.jboss.modules] JBoss Modules version 1.1.1.GA
08:44:21,586 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
08:44:21,649 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
***ERROR*** JBoss Application Server 7.1.1.Final has failed to start. Error: Managed server was not started within [90] s
[feedback]$ 

What I did was to create a batch script to set JAVA_HOME to a JDK 7 before launching jbdevstudio.exe:


This way, JBDS continues using Java 8:


But AS 7 starts with Java 7:


(Tool: MS Process Explorer)





Tips:

  • If JBDS begins starting without asking for workspace (just using a default workspace), you can use jbdevstudio.exe -clean to force it to start asking for workspace each time.






No hay comentarios: