I am trying to do the following :
execute some database scripts during mvn test phase into hsqldb
use that database for test purpose
I was able to configure maven so that each time test phase is called all scripts are executed successfully, but (of course there is a BUT), all my tests failed.
My configurations :
pom.xml
<build>
<plugins>
<!-- Plugin maven for sql -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<dependencies>
<!-- Dependency to jdbc driver -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsql-version}</version>
</dependency>
</dependencies>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:mem:sweetdev_skill_db;shutdown=false</url>
<settingsKey>hsql-db-test</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true-->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<!-- Create integration test data before running the tests -->
<execution>
<id>create-integration-test-data</id>
<phase>process-test-resources</phase>
<inherited>true</inherited>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<url>jdbc:hsqldb:mem:db;shutdown=false</url>
<autocommit>true</autocommit>
<orderFile>ascending</orderFile>
<fileset>
<basedir>${basedir}/src/test/resources/sql</basedir>
<includes>
<include>create.sql</include>
<include>insert.sql</include>
</includes>
</fileset>
</configuration>
</execution>
<!-- Drop data after executing tests -->
<execution>
<id>drop-db-after-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<fileset>
<basedir>${basedir}/src/test/resources/sql</basedir>
<includes>
<include>drop.sql</include>
</includes>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
spring config for test :
<bean id="datasource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver">
</property>
<property name="url" value="jdbc:hsqldb:mem:db"></property>
<property name="username" value="sa">
</property>
<property name="password" value="">
</property>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="datasource" />
<!-- use testingSetup pu -->
<property name="persistenceUnitName" value="testingSetup" />
<property name="persistenceXmlLocation" value="persistence.xml" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" />
<property name="generateDdl" value="true" />
</bean>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
Output :
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory D:\dev\projects\project-data\target
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 62 source files to D:\dev\projects\project-data\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [sql:execute {execution: create-integration-test-data}]
[INFO] Executing file: D:\dev\projects\project-data\src\test\resources\sql\create.sql
[INFO] Executing file: D:\dev\projects\project-data\src\test\resources\sql\insert.sql
[INFO] 230 of 230 SQL statements executed successfully
[INFO] [compiler:testCompile]
[INFO] Compiling 12 source files to D:\dev\projects\project-data\target\test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: D:\dev\projects\project-data\target\surefire-reports
But then all my test fail. I need your help to figure out why it doesn't work and help me find solution. Thank you
#AndrewLogvinov
Here is one of test output :
-------------------------------------------------------------------------------
Test set: com.ideo.sweetdevskill.data.impl.TestAcquisitionDAOImpl
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.17 sec <<< FAILURE!
testGetListAcquisitionByUser(com.ideo.sweetdevskill.data.impl.TestAcquisitionDAOImpl) Time elapsed: 0.148 sec <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.ideo.sweetdevskill.data.impl.TestAcquisitionDAOImpl.testGetListAcquisitionByUser(TestAcquisitionDAOImpl.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Thanks !
Compare these lines in your config. The database names are different, therefore two different databases are being used.
<url>jdbc:hsqldb:mem:sweetdev_skill_db;shutdown=false</url>
<property name="url" value="jdbc:hsqldb:mem:db"></property>
I have promised to post the solution, so here I am.
Let's start with ths spring config
<?xml version="1.0" encoding="UTF-8"?>
<!--beans followed by all xml schemas here -->
<!-- HSQL datasource for test purpose-->
<bean id="datasource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:file:db" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
<!-- ============================ ENTITY MANAGER ================================= -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="datasource" />
<!-- use testingSetup pu -->
<property name="persistenceUnitName" value="testingSetup" />
<property name="persistenceXmlLocation" value="persistence.xml" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" />
<property name="generateDdl" value="false" />
</bean>
</property>
</bean>
<!-- all other things you may need-->
</beans>
persistence.xml would have same structure as for application
inside pom.xml of the project : (I only include here the related part :
<!-- Plugin maven for sql -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<dependencies>
<!-- Dependency to jdbc driver -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsql-version}</version>
</dependency>
</dependencies>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:file:${basedir}/db;shutdown=true</url>
<autocommit>true</autocommit>
<settingsKey>hsql-db-test</settingsKey>
<!--all executions are ignored if -DskipTests=true-->
<skip>${skipTests}</skip>
</configuration>
<executions>
<!-- Create test data before running the tests -->
<execution>
<id>create-test-compile-data</id>
<phase>process-test-sources</phase>
<inherited>true</inherited>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<url>jdbc:hsqldb:file:${basedir}/db;shutdown=true</url>
<driver>org.hsqldb.jdbcDriver</driver>
<orderFile>ascending</orderFile>
<detail>true</detail>
<fileset>
<basedir>${basedir}/src/test/resources/sql</basedir>
<includes>
<include>script-create.sql</include>
<include>script-insert.sql</include>
</includes>
</fileset>
<autocommit>true</autocommit>
</configuration>
</execution>
<!-- Drop test data after running the tests include hereafter -->
</plugin>
Thanks for your help.
Related
When using the following SQL From a single temp Table.
Select DataType as '#Datatype',
(Select
'Order' as [Property/#name],
Order1 as Property,
null,
'ExtCode' as [Property/#name],
ExtCode as Property,
null
from #TempLine
for xml path('Properties'), type
)
from #TempLine
Group by DataType
for xml path('Object'), root('Objects')
I am getting the following XML
<Objects>
<Object Datatype="ItemInfo">
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#ISSMS</Property>
</Properties>
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#IMF</Property>
</Properties>
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#ILZF</Property>
</Properties>
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#L5898.5W</Property>
</Properties>
</Object>
</Objects>
I Need to return the following XML with Object surrounding Properties.
<Objects>
<Object Datatype="ItemInfo">
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#ISSMS</Property>
</Properties>
</Object>
<Object Datatype="ItemInfo">
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#IMF</Property>
</Properties>
</Object>
<Object Datatype="ItemInfo">
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#ILZF</Property>
</Properties>
</Object>
<Object Datatype="ItemInfo">
<Properties>
<Property name="Order">150825CREC004</Property>
<Property name="ExtCode">150825CREC004#L5898.5W</Property>
</Properties>
</Object>
</Objects>
I thought I could do it with embedded select but its not working out. I need to be able to have the object surround each of the properties and not the whole block.
I am configuring one HSQLDB database inside the application folder, follow below the persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="crmUnity" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>br.com.crm.model.entities.Cliente</class>
<class>br.com.crm.model.entities.Contato</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
<property name="hibernate.connection.url" value="jdbc:hsqldb:file://database/crm;shutdown=true" />
<property name="hibernate.connection.user" value="sa" />
<property name="hibernate.flushMode" value="FLUSH_AUTO" />
</properties>
</persistence-unit>
</persistence>
The JBOSS 7.1.3 while starting show the error on log:
18:40:10,477 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (ServerService Thread Pool -- 170) HHH000319: Could not get database metadata: java.sql.SQLException: No suitable driver found for jdbc:hsqldb:file://database/crm;shutdown=true
Can anybody help me about configure the jdbc url to resolve this error?
Thank's, TarcĂsio.
I currently have an ant task that does a great job of generating my domain objects from xsd and xjb binding files. It creates the annotations and injects code where I need it based upon a custom Plugin.
Now I'm trying to move all of this to Maven and while I can generate the objects I cannot get the code to inject or add the annotations. My POM plugin entry is as follows:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<bindingDirectory>src/main/resources/jaxb/bindings</bindingDirectory>
<generatePackage>com.noush.web.domain.model.data</generatePackage>
<extension>true</extension>
<verbose>true</verbose>
<args><!-- <arg>-XtoString</arg> -->
<!-- I want to use commons-lang-plugin to generate toString but this can
wait <arg>-Xcommons-lang</arg> <arg>-Xcommons-lang:ToStringStyle=SIMPLE_STYLE</arg> -->
<arg>-Xannotate</arg>
<arg>-Xinject-code</arg>
</args>
<plugins>
<plugin>
<groupId>noush</groupId>
<artifactId>code-expander-plugin</artifactId>
<version>1.0</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
The objects get created but without any injected code or annotations. The output doesn't give any indication that anything is wrong.
If it helps here is my working ant config:
<target name="defineXjcTask">
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpathref="xjcLib" />
</target>
<target name="generateJaxb">
<xjc target="${build.generated}" package="${noushweb.domain.model.jaxb.package}">
<arg value="-verbose"/>
<arg value="-extension"/>
<arg value="-Xcommons-lang"/>
<arg value="-Xcommons-lang:ToStringStyle=SIMPLE_STYLE"/>
<arg value="-Xinject-code"/>
<arg value="-Xannotate"/>
<schema dir="${build.directory}/jaxb/bindings" includes="${matmWS.mmmws.data.filename}" />
<binding dir="${build.directory}/jaxb/bindings" includes="${matmWS.mmmws.binding.filename}"/>
<produces dir="${build.generated}/${noushweb.domain.model.jaxb.package.dir}" includes="**/*.java" />
</xjc>
</target>
<path id="xjcLib">
<pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jaxb-xjc.jar" />
<pathelement location="${ib.dir}/jaxb-ri-2.0.5/lib/jaxb-api.jar" />
<pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jaxb-impl.jar" />
<pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/activation.jar" />
<pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jsr173_1.0_api.jar" />
<pathelement location="../lib/stax-api-1.0-2.jar" />
<pathelement location="../lib/jaxb-commons-lang-plugin-2.2.jar" />
<pathelement location="${lib.dir}/commons-lang-2.4/lib/commons-lang-2.4.jar" />
<pathelement location="../lib/code-expander-plugin.jar" />
<pathelement location="../lib/jaxb2-basics-runtime-0.6.0.jar" />
<pathelement location="../lib/jaxb2-basics-tools-0.6.0.jar" />
<pathelement location="../lib/jaxb2-basics-annotate-0.6.0.jar" />
<pathelement location="../lib/annox-0.5.0.jar" />
<pathelement location="${lib.dir}/axis-1_4/lib/commons-logging-1.0.4.jar" />
<pathelement location="${lib.dir}/hibernate-validator-4.1.0.Final/hibernate-validator-4.1.0.Final.jar"/>
<pathelement location="${lib.dir}/hibernate-validator-4.1.0.Final/validation-api-1.0.0.GA.jar"/>
</path>
I guess I could use a antrun kind of setup but I was hoping I could get this to work.
Any thoughts would be most welcome.
Thanks
Noush
Regardless of the following persistence.xml configuration the database is persisted on disk.
<persistence-unit name="com.mysimpatico_inmemory_persistence_nbm_1.0-SNAPSHOTPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.mysimpatico.memoplatform.persistence.entities.Expression</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:tempDb;create=true"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.jdbc.user" value=""/>
</properties>
http://wiki.apache.org/db-derby/InMemoryBackEndPrimer
I'm using Derby in memory for testing and my configuration is very close to yours.
Here is my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
<persistence-unit name="TestPu" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.acme.Foo</class>
<class>com.acme.Bar</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<!-- Common properties -->
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:test-jpa;create=true"/>
<property name="javax.persistence.jdbc.user" value="APP"/>
<property name="javax.persistence.jdbc.password" value="APP"/>
<!-- EclipseLink specific properties -->
<property name="eclipselink.target-database" value="Derby"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.debug" value="ALL"/>
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.logging.level.sql" value="FINEST"/>
<property name="eclipselink.logging.level.cache" value="FINEST"/>
</properties>
</persistence-unit>
</persistence>
Where org.apache.derby:derby:jar:10.6.2.1 is on the classpath.
Now two questions/suggestions:
How do you know the database is persisted on disk?
If it really does, make sure you're using the persistence.xml you think you are.
Add the following to your maven configuration
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.5.3.0</version>
<scope>test</scope>
</dependency>
The following persistance.xml works pretty well with hibernate.
<persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>myapp.model.entities.Group</class>
<class>myapp.model.entities.User</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.url" value="jdbc:derby:memory:jpa"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
</properties>
</persistence-unit>
I trying cargo-maven2-plugin, but I don't deploy in jboss5x I pom.xml is
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.2</version>
<configuration>
<container>
<containerId>jboss51x</containerId>
<home>E:\JavaWorkingTools\JBoss\jboss-5.1.0.GA</home>
<log>${basedir}/target/jboss5.1.x.logs/cargo.log</log>
<timeout>300000</timeout> <!-- 5 minutes -->
<systemProperties>
<jboss.server.log.threshold>INFO</jboss.server.log.threshold>
</systemProperties>
</container>
<configuration>
<type>existing</type>
<home>${project.build.directory}/target/jboss51x</home>
<properties>
<cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024
-XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
</properties>
</configuration>
<deployer>
<type>installed</type>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<!--
<pingURL>http://localhost:8080/${artifactId}</pingURL>
<pingTimeout>300000</pingTimeout>
-->
<pingURL>http://localhost:8080/${project.artifactId}/index.jsp</pingURL>
<properties>
<context>/${project.artifactId}</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
I run a cargo:deployer-start or cargodeployer-deploy is error
cargo:deployer-start Error message is:
Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.0.2:deployer-start (default-cli) on project SSH2Maven: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.0.2:deployer-start failed: Not supported -> [Help 1]
and cargodeployer-deploy
The Deployable state is thus unknown. ->
I read a Deploying to a running container but I dont't know how to depoly webapp in jboss5 :(
There is something strange with your configuration. Since you're using an installed existing container, I'd expect to see the path to its home, not to a directory under target. Here is a configuration I'm using:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.2</version>
<configuration>
<container>
<containerId>jboss51x</containerId>
<append>false</append>
<log>${project.build.directory}/logs/jboss51x.log</log>
<output>${project.build.directory}/logs/jboss51x.out</output>
<timeout>300000</timeout><!-- 5 minutes -->
</container>
<configuration>
<type>existing</type>
<home>/path/to/jboss-5.1.0.GA</home>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.jboss.configuration>default</cargo.jboss.configuration>
<cargo.rmi.port>1099</cargo.rmi.port>
<cargo.logging>high</cargo.logging>
</properties>
<deployables>
<!-- application to deploy -->
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>myapp</artifactId>
<type>war</type>
<!--
<properties>
<context>acontext</context>
</properties>
-->
</deployable>
</deployables>
</configuration>
</configuration>
</plugin>