Hi All,

I'm using Maven to build a simple project that generates two artifacts: the first is a jar; the second an executable version of the same jar, including all the dependencies so that it can be run standalone from a command line. I'm using the maven-assembly-plugin to create the executable, using the 'jar-with-dependencies' predefined descriptor.

I'm trying to use SHITTY to do some system testing of the 'jar-with-dependencies'. My test project uses the maven-dependency-plugin to get a copy of the 'jar-with-dependencies' artifact (using the 'jar-with-dependencies' classifier). I've followed the usage instructions for setting up SHITTY, and it is successfully invoked. However, it doesn't seem to handle the two artifacts correctly. Here's a snippet of the output from a 'mvn -Dshit integration-test' run (sorry for the line-wrapping):

-----------------------------------------------
...
[INFO] [shitty:install {execution: default}]
[INFO] Installing C:\Documents and Settings\Mick\workspace\Feature-Sketch\featur
esketch\target\featuresketch-0.0.1-SNAPSHOT.jar to C:\Documents and Settings\Mic
k\.m2\repository\in\sinking\featuresketch\featuresketch\testing\featuresketch-te
sting.jar
[INFO] Installing C:\Documents and Settings\Mick\workspace\Feature-Sketch\featur
esketch\target\featuresketch-0.0.1-SNAPSHOT-jar-with-dependencies.jar to C:\Docu
ments and Settings\Mick\.m2\repository\in\sinking\featuresketch\featuresketch\te
sting\featuresketch-testing.jar
[INFO] [shitty:test {execution: default}]
[INFO] Starting 1 test build(s)
...
------------------------------------------------

Notice that the two jars are installed into the repository for testing with the same artifactId and version - the 'jar-with-dependencies' artifact overwrites the main jar, and has lost the jar-with-dependencies classifier. My test project (i.e. the one in the src/it/ directory under the main project) attempts to find the executable jar in the repository like this:

------------------------------------------------
<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>copy</id>
      <phase>pre-integration-test</phase>
      <goals>
        <goal>copy</goal>
      </goals>
      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>in.sinking.featuresketch</groupId>
            <artifactId>featuresketch</artifactId>
            <version>testing</version>
            <classifier>jar-with-dependencies</classifier>
            <type>jar</type>
          </artifactItem>
        </artifactItems>
      </configuration>
    </execution>
  </executions>
</plugin>
------------------------------------------------

but fails. If I comment out the <classifier>...</classifier> line, then the executable jar is found and my tests run. However, this seems far from ideal. Have I missed something in my setup, am I misusing Maven and/or SHITTY, or have I found a problem with SHITTY?

For completeness, I include the parts of the pom.xml for the project-under-test responsible for configuring the SHITTY and the maven-assembly-plugin:

-------------------------------------------------
<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
          <manifest>
            <mainClass>in.sinking.featuresketch.Main</mainClass>
          </manifest>
        </archive>
      </configuration>
      <executions>
        <execution>
          <id>make-assembly</id>
          <phase>package</phase>
          <goals>
            <goal>attached</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
<profiles>
  <profile>
    <id>super-helpful-integration-tests</id>
    <activation>
      <property>
        <name>shit</name>
        <value>true</value>
      </property>
    </activation>
    <build>
      <defaultGoal>install</defaultGoal>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>shitty-maven-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>clean</goal>
                <goal>install</goal>
                <goal>test</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>

-------------------------------------------------

I'm sorry if any of this is unclear - I'm new to Maven and have a whole new vocabulary to learn. Please ask if I can give any more information.

(While searching the archives I found the recent 'Integration testing a project?' thread, started by Joshua Pollak. That thread appears to have a solution that I could use - in fact, Joshua's problem sounds exactly like the situation I was in before I discovered SHITTY - but I'd like to stick with SHITTY if possible: I like the idea of keeping these tests *inside* the top-level project, rather than creating a sibling.)

Thanks for your advice,

Mick

--
Mick Brooks
ACCU Membership Secretary  -  [EMAIL PROTECTED]
http://www.accu.org/ - Professionalism in Programming

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to