SOAP Tracer in WSOEI is gone? - wso2-esb

New release. Instead of WSO2ESB server now WSOEI released. Good parts, less config has to be done to install DSS feature, it is builtin now.
Bad parts is SOAP Message Tracer is gone, Mediation-Tracer is gone. I thought they are moved to feature(repository) and need to install them separate, but repository(feature link) gone as well from Configure tab.
Does anyone know how to get them back?

Find out how to install soaptracer on wso2ei-6.1.1. You must have apache ant and maven executable to be in $PATH
Copy underneath pom.xml to WSO2EI_BASEDIR
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mediation.tracer</groupId>
<artifactId>mediation-tracer-feature-installation</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<name>Mediation Tracer Feature</name>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>1.5.4</version>
<executions>
<execution>
<id>feature-install</id>
<phase>package</phase>
<goals>
<goal>p2-profile-gen</goal>
</goals>
<configuration>
<profile>default</profile>
<metadataRepository>http://product-dist.wso2.com/p2/carbon/releases/wilkes/</metadataRepository>
<artifactRepository>http://product-dist.wso2.com/p2/carbon/releases/wilkes/</artifactRepository>
<destination>${WSO_BASEDIR}/wso2/components</destination>
<deleteOldProfileFiles>false</deleteOldProfileFiles>
<features>
<feature>
<id>org.wso2.carbon.soaptracer.feature.group</id>
<version>4.5.4</version>
</feature>
</features>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<replace token="false" value="true" dir="${WSO_BASEDIR}/wso2/components/default/configuration/org.eclipse.equinox.simpleconfigurator">
<include name="**/bundles.info"/>
</replace>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>wso2-maven-releases-repository</id>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
</pluginRepository>
<pluginRepository>
<id>wso2-maven-snapshots-repository</id>
<url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
</project>
then set environment variable ${WSO_BASEDIR}
export WSO_BASEDIR=/home/path_to_wso2ei-6.1.1_folder
execute command
mvn clean install
if there are no errors in console, start wso2ei and you will see SoapTracer in carbon(admin) menu.

Related

Only one of tofile and todir may be set

When I compile a project with the POM contents as given below with clean install post-site -Pdev, I get the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project test-copy: An Ant BuildException has occured:
Only one of tofile and todir may be set.
[ERROR] around Ant part ...<copy todir="temp/config" file="temp1/temp1.conf" tofile="temp2/temp.conf" failonerror="false">... # 5:98 in Projects/TestCopy/test-copy/target/antrun/build-main.xml
How do I fix this problem?
Ant script that got generated during compiling:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="maven-antrun-" default="main" >
<target name="main">
<echo>Base Dir:</echo>
<copy todir="temp/config" file="temp1/temp1.conf" tofile="temp2/temp.conf" failonerror="false">
<fileset file="/Users/Projects/TestCopy/test-copy/*.conf"/>
</copy>
</target>
</project>
POM Contents:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>temp.test.copy</groupId>
<artifactId>test-copy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test-copy</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Base Dir1: </echo>
<copy todir="temp/config" failonerror="false">
<fileset file="${basedir}/*.conf"/>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>post-site</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Base Dir: </echo>
<copy file="temp1/temp1.conf"
tofile="temp2/temp.conf">
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
The problem is the missing id tags in your executions. Since you did not define an id, Maven will use default. Now you have a default execution in your base pom as well as one in your dev profile.
Since the id is identical, maven simply merges poth definitions, resulting in the rather weird mixed ant that you got.
So simply add to different <id> tags to bot executions and you are fine.
Additional note:
You should always included ids in your executions, in addition to preventing effects like your problem, they server als as documentation, because the id is printed out during the build. So choose something meaningful like: copy-configuration-dir and copy-single-config-to-site.

Unit Testing Postgres Database with Maven

First let me explain what I am doing:
Creating a Java project in Eclipse (JUNO) to unit test SQL for a Postgres database.
Using Maven2 as the build tool. I have DBUnit, and SQL maven plugins.
The goal is to drop the schema and rebuild the tables and load some data in the tables.
I've tested the SQL so I know it works. I have tested the connections so I know the URL is right.
Now onto my problem. I am new to Maven for unit testing SQL. I have tried to follow most of the online documentation. I have created my pom from the examples. While the Java code compiles, the build blows by the SQL work in the pom.xml file. Here is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.premierinc.esd</groupId>
<artifactId>sqlunittest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sqlunittest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>3.8.1</junit.version>
<maven.compiler.plugin.version>2.5.1</maven.compiler.plugin.version>
<sql.maven.plugin.version>1.5</sql.maven.plugin.version>
<postgresql.jdbc.version>9.1-901.jdbc4</postgresql.jdbc.version>
</properties>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>${sql.maven.plugin.version}</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<id>drop-schema-before-test-if-any</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<!-- need another database to drop the targeted one -->
<url>jdbc:postgresql://localhost:5432:postgres</url>
<autocommit>true</autocommit>
<sqlCommand>DROP SCHEMA chipen CASCADE</sqlCommand>
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/main/sql/CHI-PEN-schema.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
<!-- specific configurations -->
<configuration>
<type>CLEAN_INSERT</type>
<src>src/test/data/testdb_chipen_data.xml</src>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Any suggestions or hints would be greatly appreciated.
Thanks in advance.
I add the pom of your post here in corrected form. I have removed in particular the repository definition, cause they are the defaults in Maven so convention over configurations mean to define only what is really needed to define.
Furthermore i have removed the pluginManagement tags, cause this means not to really execute the things it means define things. To be more accurate pluginManagement is intended to define the versions of plugins but usually not the configuration. This is usually used in parent pom's:
<project ...>
..
<build>
<pluginManagement>
<plugins>
<plugin>
Plugin groupId, artifactId, version
</plugin>
.
</plugin>
</pluginManagement>
..
</project>
Let us get back to your pom. The follow should run:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.premierinc.esd</groupId>
<artifactId>sqlunittest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sqlunittest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>3.8.1</junit.version>
<maven.compiler.plugin.version>2.5.1</maven.compiler.plugin.version>
<sql.maven.plugin.version>1.5</sql.maven.plugin.version>
<postgresql.jdbc.version>9.1-901.jdbc4</postgresql.jdbc.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>${sql.maven.plugin.version}</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<id>drop-schema-before-test-if-any</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<!-- need another database to drop the targeted one -->
<url>jdbc:postgresql://localhost:5432:postgres</url>
<autocommit>true</autocommit>
<sqlCommand>DROP SCHEMA chipen CASCADE</sqlCommand>
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/main/sql/CHI-PEN-schema.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
<!-- specific configurations -->
<configuration>
<type>CLEAN_INSERT</type>
<src>src/test/data/testdb_chipen_data.xml</src>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Apart from the above a thing like this are integration tests and not unit tests but this is a different question/discussion.

Why maven compilation doesn't work with "pom" packaging type

I don't know why my maven build doesn't generate target/classes in current pom setting, the packaging type must be "pom" in my case, please advise what is wrong... Thanks!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.sm.doctor</groupId>
<artifactId>smdoctor</artifactId>
<packaging>pom</packaging>
<version>${SMDOCTOR_VERSION}</version>
<name>sm doctor</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<debug>true</debug>
<debuglevel>source,lines</debuglevel>
<showDeprecation>true</showDeprecation>
<archive>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>smdoctor</finalName>
<descriptors>
<descriptor>dist.xml</descriptor>
<descriptor>zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/smdoctor.zip</file>
<type>zip</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>...</mainClass>
</manifest>
</archive>
</configuration>
<version>2.3.1</version>
</plugin>
</plugins>
</build>
<dependencies>
...
</dependencies>
By setting the packaging type to pom, you specify that nothing should be compiled. Maybe pom isn't the right packaging type for this artifact after all? It looks like your script would run fine as jar.
The compiler plugin is not bound to any phase in the maven lifecycle with packaging pom. You would have to configure an execution like you did for the assemby plugin:
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
If your sources are in a folder other than src/main/java you would have to configure this folder in the build section of your pom:
<build>
<sourceDirectory>${basedir}/path/to/sources</sourceDirectory>
<!-- plugins and other configuration -->
</build>
pom packaging is just to let other modules inherit common and regular configurations such as plugins, dependencies, contributors, developers,....and so on for child modules. Just remember that it won't go beyond validate phase.
This packaging is logical and not real one and so you should not put any real code or resources at that level. If you use junit in say 5 child modules, so rather than defining the dependency in 5 pom files then you can just do it in the parent pom with pom packaging, and you still can specify specific version in your module if you like to override what's in the parent pom. When you run the parent pom then the pom execution starts from parent to children and then all dependencies are retrieved from up to down.
That's how i understand pom packaging. So, If you have code with such packaging this means that your maven project structure need amendment. Only use packaging pom as a common configurations between multiple modules only

Unzip dependency in maven

I have the following dependency in maven
<dependency>
<groupId>org.hyperic</groupId>
<artifactId>sigar-dist</artifactId>
<version>1.6.5.132</version>
<type>zip</type>
</dependency>
This creates sigar-dist-1.6.5.132.zip in my repository.
I have seen this question here, however I still can't make it work.
How can I unzip the sigar-dist.zip and place the content in a directory in my project? What is the mvn call I have to do to make it work?
You can do it with dependencies:unpack-dependencies:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>unpack-sigar</id>
<phase>package<!-- or any other valid maven phase --></phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.hyperic</includeGroupIds>
<includeArtifactIds>sigar-dist</includeArtifactIds>
<outputDirectory>
${project.build.directory}/wherever/you/want/it
<!-- or: ${project.basedir}/wherever/you/want/it -->
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Reference:
Unpacking project dependencies
dependency:unpack-dependencies
just a follow up on answer from #Sean Patrick Floyd
this is my final pom.xml to download and unpack tomcat
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.koushik.javabrains</groupId>
<artifactId>tomcat</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>tomcat</name>
<properties>
<tomcat.version>8.0.27</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>unpack-tomcat</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.apache.tomcat</includeGroupIds>
<includeArtifactIds>tomcat</includeArtifactIds>
<outputDirectory>
${project.build.directory}
<!-- or: ${project.basedir}/wherever/you/want/it -->
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
<type>zip</type>
</dependency>
</dependencies>
</project>

Maven circular dependency?

If I add this to a POM will it create a circular dependency? I've tried it and that what seems to happen. There is something I'm not understanding here. Isn't the war file created at the end of the build.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mywebapp</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>provided</scope>
</dependency>
My directory structure is root/functest, root/mywebapp.
Effective POM
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] org.grails: checking for updates from tapestry.javaforge
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ee0f52bc37051384f078f9706be9445b550ee4a6'; remote = 'a535436f42caf1ba0f9372328d2920372f30c842' - RETRYING
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ee0f52bc37051384f078f9706be9445b550ee4a6'; remote = 'a535436f42caf1ba0f9372328d2920372f30c842' - IGNORING
[INFO] org.apache.maven.plugins: checking for updates from tapestry.javaforge
[INFO] org.codehaus.mojo: checking for updates from tapestry.javaforge
[INFO] artifact org.apache.maven.plugins:maven-help-plugin: checking for updates from tapestry.javaforge
[INFO] ------------------------------------------------------------------------
[INFO] Building functional-tests
[INFO] task-segment: [help:effective-pom] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:effective-pom]
[INFO]
Effective POMs, after inheritance, interpolation, and profiles are applied:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- -->
<!-- Generated by Maven Help Plugin on 9/30/09 10:41 AM -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/ -->
<!-- -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Effective POM for project 'com.mycompany:functest:pom:1.0-SNAPSHOT' -->
<!-- -->
<!-- ====================================================================== -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>myapp</artifactId>
<groupId>com.mycompany</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.mycompany</groupId>
<artifactId>functest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>functional-tests</name>
<url>http://www.mycompany.com/functest</url>
<organization>
<name>My Company Inc</name>
<url>http://www.mycompany.com</url>
</organization>
<developers>
<developer>
<id>john.doe</id>
<name>John Doe</name>
<email>john.doe#mycompany.com</email>
</developer>
</developers>
<build>
<sourceDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\main\java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\it</testSourceDirectory>
<outputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target\classes</outputDirectory>
<testOutputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target\test-classes</testOutputDirectory>
<resources>
<resource>
<mergeId>resource-0</mergeId>
<directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\main\resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<mergeId>resource-1</mergeId>
<directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\test\resources</directory>
</testResource>
</testResources>
<directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target</directory>
<finalName>functest-1.0-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-8</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0-beta-7</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/it/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<parallel>true</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.1-alpha-1</version>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
<configuration>
<deployer>
<deployables>
<deployable>
<groupId>com.mycompany</groupId>
<artifactId>mywebapp</artifactId>
<type>war</type>
<pingURL>http://localhost:8080/mywebapp/index.html</pingURL>
<pingTimeout>300000</pingTimeout>
<properties>
<context>mywebapp</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat5x</containerId>
<zipUrlInstaller>
<url>http://www.apache.org/dist/tomcat/tomcat-5/v5.5.28/bin/apache-tomcat-5.5.28.zip</url>
<installDir>${installDir}</installDir>
</zipUrlInstaller>
<output>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/tomcat5x.log</output>
<log>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/cargo.log</log>
</container>
<configuration>
<home>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/tomcat5x/container</home>
<properties>
<cargo.logging>high</cargo.logging>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
<plugin>
<artifactId>maven-help-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots />
<id>public-snapshots</id>
<url>http://public-snapshots</url>
</repository>
<repository>
<releases />
<snapshots />
<id>openqa-releases</id>
<url>http://nexus.openqa.org/content/repositories/releases</url>
</repository>
<repository>
<id>openqa</id>
<url>http://maven.openqa.org</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots />
<id>public-snapshots</id>
<url>http://public-snapshots</url>
</pluginRepository>
<pluginRepository>
<releases />
<snapshots />
<id>openqa-plugin</id>
<url>http://nexus.openqa.org/content/repositories/releases</url>
</pluginRepository>
<pluginRepository>
<releases />
<snapshots />
<id>another-plugin</id>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
<pluginRepository>
<releases />
<id>codehaus.snapshots</id>
<url>http://snapshots.repository.codehaus.org/</url>
</pluginRepository>
<pluginRepository>
<id>mortbay.repo</id>
<url>http://www.mortbay.org/maven2/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>tapestry.javaforge</id>
<url>http://howardlewisship.com/repository</url>
</pluginRepository>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mywebapp</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.server</groupId>
<artifactId>selenium-server</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.1</version>
<classifier>jdk15</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<outputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/site</outputDirectory>
</reporting>
</project>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Sep 30 10:41:00 CEST 2009
[INFO] Final Memory: 7M/13M
[INFO] ------------------------------------------------------------------------
It will only create a cyclic dependency if mywebapp is dependent on functest (or transitively dependent on it). From the name I would guess that functest is a test component so no such dependency would exist.
As you've seen, it is valid to substitute properties into dependency declarations, Maven will fail the build if it does result in a cycle.
I guess your confusion around "Isn't the war file created at the end of the build." is because you expect the build to fail as functest is built before mywebapp? Remember that Maven has access to local and remote repositories, so the result of any previous build of mywebapp will be available in the repository. If this is the case, try deleting mywebapp from you local/remote repositories and I suspect you will see the build fail due to an unresolved dependency.
If I add this to a POM will it create a circular dependency?
If the pom you are referring to is the pom of the functest module, adding a dependency to the mywebapp module will create a circular dependency only if the mywebapp module already depends on the functest module (which should not be the case here) as stated by Rich in another answer.
I've tried it and that what seems to happen.
Are you sure? Is your multi-modules project well defined? Can you show us the parent pom? Can you provide the trace obtained when launching maven from the parent?
[...] Isn't the war file created at the end of the build?
Well... it depends on what you are doing.
If you are strictly following Automated Smoke Tests With Selenium, Cargo, TestNG and Maven, please note that the author is not really covering the multi-modules project setup (I'm not saying he's not doing it, I'm just saying he's not covering that part) but only the functional testing project setup. He always launch maven from the functest directory, never as a reactor from the parent pom, and the webapp deployed by cargo in the step 7 is treated like an "external" dependency.
Now, if you are developing your own webapp, building it prior to run functional tests on it really makes sense. Actually, this would be the "recommended" approach. In your case, be sure to declare mywebapp as a dependency of functest and to declare both projects as modules of the parent pom, i.e. something like that (if the parent pom is in a parent directory):
...
<modules>
<module>mywebapp</module>
<module>functest</module>
</modules>
...