-
Notifications
You must be signed in to change notification settings - Fork 56
Working With Maven
IMPORTANT: Zanata's wiki has moved to https://github.com/zanata/zanata-platform/wiki
New link: https://github.com/zanata/zanata-platform/wiki/Working-With-Maven
Download Maven from http://maven.apache.org/download.cgi. Version 3.0.x is recommended.
Extract the archive to e.g. /opt/apache-maven-3.0
.
You then need to ensure the mvn
command is in your path. As root, create a file such as /etc/profile.d/maven.sh
with the following contents:
export MAVEN_HOME=/opt/apache-maven-3.0
export PATH=$PATH:$MAVEN_HOME/bin
After restarting your console-session, you should now be able to run mvn
.
Extract the archive to e.g. ~/apps/apache-maven-3.0
.
You then need to ensure the mvn
command is in your path. Add these lines to your .bashrc (or similar)
export MAVEN_HOME=~/apps/apache-maven-3.0
export PATH=$PATH:$MAVEN_HOME/bin
After restarting your console-session, you should now be able to run mvn
.
By default, if you run mvn verify
(or package
or install
), both the Arquillian tests and a few functional tests will be run. The build will download and install a local copy of the app server to use in the test.
Use -DallFuncTests
if you want all the functional tests, not just the Basic Acceptance Tests.
Due to a limitation in Maven's ability to run plugin A, then B, then A again in the same phase (eg pre-integration-test
), we actually have to start preparing the appserver in the prepare-package
phase. So even when just running mvn package
, you have to choose an appserver or disable all integration tests.
However, due to other limitations in Maven 3.0's profile activation, it doesn't reliably default to wildfly 8 as it should. (So, you have to use mvn verify -Dappserver=wildfly8
, not just mvn verify
.)
For the standard version WildFly (recommended for most development, currently 8.1.0.Final):
mvn -Dwildfly8 verify # -DallFuncTests for all tests
Overriding the WildFly version (only tested with 8.2.0.Final):
mvn -Dwildfly8 \
-Dcargo.installation=http://download.jboss.org/wildfly/8.2.0.Final/wildfly-8.2.0.Final.zip \
-Dcargo.basename=8.2.0.Final verify
For EAP 6 (recommended for production, and release testing):
To test against EAP6, you will need to provide a URL containing EAP6 as a zip. For instance:
mvn -Djbosseap6 \
-Dcargo.installation=http://example.com/downloads/myjbosseap63.zip \
-Dcargo.basename=myjbosseap63 verify # -DallFuncTests for all tests
To skip Arquillian tests:
mvn verify -Dwildfly8 -DskipArqTests ...
To skip functional tests:
mvn verify -Dwildfly8 -DskipFuncTests ...
To skip both types of integration test:
mvn verify -DskipArqTests -DskipFuncTests ...
You ought to be able to use -DskipITs
instead, but we haven't found a good way to do this without duplicating a lot of Maven config. If you do use -DskipITs
, the tests will be skipped, but the appserver will still be downloaded and/or installed twice (and started once)!
To skip all tests:
mvn verify -DskipUnitTests -DskipArqTests -DskipFuncTests ...
To run unit tests only:
mvn test # as it should be
By default, the build will use the same appserver ports for every build. If you try to run multiple simultaneous builds on the same machine, you will get port conflicts.
build.sh
is a wrapper script which pre-allocates a number of random ports for the tests to use, then runs mvn
with your chosen options.
For instance:
./build.sh -Dwildfly8 verify
If you need to allocate the ports directly (or you want to add a new port), see etc/scripts/allocate-jboss-ports
and etc/scripts/allocate-ports
.
-
wildfly8
- Enable testing against Wildfly 8 (automatically installed undertarget/
) -
jbosseap6
- Enable testing against EAP 6 (NB: you need to provide a URL for an EAP zip; automatically installed undertarget/
) -
allFuncTests
- Enable all functional tests, not just smoke tests (BATs) -
nogwt
- Skips GWT compilation (for use with DevMode) -
chrome
- speeds up GWT compilation by targeting Safari/Chrome browsers only -
firefox
- speeds up GWT compilation by targeting Mozilla browsers only -
explode
- Enables exploded deployment during the 'package' phase. -
replace-static
- Replace exploded deployment without triggering a redeployment. Useful when you are just changing xhtml or similar static content. -
dev
- Activates common development settings (enable debug, import test data) -
mysql
- Activates settings for using mysql as the datasource (H2 is the default) -
eclipse
- Activates common development settings for eclipse
-
-Dgwt.validateOnly
- check GWT modules but don't compile them -
-Dgwt.compiler.skip
- another (more standard) way of skipping GWT compilation -
-Dtest=MyTest
- runs only tests which match*MyTest*
; useful for re-running a unit test -
-Dit.test=MyTest
- runs only tests which match*MyTest*
; useful for re-running an integration test -
-Darquillian.jboss.home=/my/jboss
- When running integration tests, tells maven where to find the jboss server to use. [Obsolete]
-Dinclude.test.patterns
(still works, but easier to use -DallFuncTests
if you want to run all tests)
-Dcargo.installation
(unless using -Djbosseap6
) NB: Don't use zanata-server.zip
for testing any more.
-Darquillian.jboss.home
(obsolete; cargo downloads everything now)
-Dfunctional-test
(obsolete; use -DskipFuncTests
to disable functional tests now)
-DnewCompiler
(obsolete; we changed the Groovy compiler)
mvn -Peclipse,dev,nogwt -DskipTests=true install eclipse:clean eclipse:eclipse
In maven settings.xml, insert <jboss.home>
tag
<profile>
<id>default</id>
<properties>
<jboss.home>${your.jboss.path}</jboss.home>
...
mvn -Pexplode -DskipTests -DskipArqTests -DskipFuncTests package
or more commonly one of these (disable GWT compilation; enable debug and testdata):
mvn -Pexplode,nogwt -DskipTests -DskipArqTests -DskipFuncTests package
mvn -Dchrome -DskipTests -DskipArqTests -DskipFuncTests package
mvn -Dnogwt -Dappserver=wildfly8 -DskipFuncTests verify
mvn -Dchrome -Dappserver=wildfly8 -DskipArqTests verify
mvn -Dchrome -Dappserver=wildfly8 -DskipArqTests -DallFuncTests verify
See http://community.jboss.org/wiki/MavenGettingStarted-Users