The difference between the two is subtle. In the copy/unpack, I needed
to replicate the resolution code and the ability to resolve something
from a sibling project that isn't installed is not there yet. The
xxx-dependencies goals rely on maven to do the resolution and then the
plugin filters down to the individual artifacts.

 

From: Joshua Pollak [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 07, 2008 2:23 PM
To: [email protected]
Subject: Re: [mojo-user] Integration testing a project?

 

I made a bit of progress, and I think I got it working. Here are the
changes I made:

 

Added the type and classifier qualification to the dependency:

 

    <dependency>

      <groupId>com.kiva</groupId>

      <artifactId>mhs-core</artifactId>

      <version>${project.version}</version>

      <type>tar.bz2</type>

      <classifier>server</classifier>

      <scope>test</scope>

    </dependency>

 

Changed to <goal>unpack-dependencies</goal> in the
maven-dependency-plugin. I think Brian mentioned this, but I didn't get
it at first. I still don't see why the unpack goal doesn't work on why
the unpack-dependencies one does. The unpack goal seems targeted at
single dependencies, and the latter seems targeted at multiple ones, and
I'm only interested in a single file, but I the unpack goal doesn't seem
to know the package is available within the current maven instance and
always tries to fetch from the repo.

 

-Josh

 

On Feb 7, 2008, at 2:35 PM, Joshua Pollak wrote:





Brian,

 

Thanks for the quick reply. I think based on your email I'm very close,
but not quite there....

 

On Feb 7, 2008, at 1:38 PM, Brian E. Fox wrote:





Put both projects under a common parent, then add the tar.bz2 as a
dependency of foo-integration-tests. 

 

Ok, thats basically what I have, except I'm unclear on how to make the
tar.bz2 a dependency of the integration project (as opposed to the jar
that is also created).

 

I have this in the integration test project, but I don't know how to
specify the tar.bz2 as opposed to the jar:

 

    <dependency>

      <groupId>com.kiva</groupId>

      <artifactId>foo-core</artifactId>

      <version>${project.version}</version>

      <scope>test</scope>

    </dependency>

 





Then change dependency:unpack to dependency:unpack-dependencies and set
the configuration to include only this artifact (by group or artifact,
type etc).

 

I have the following, is that what you mean?

 

        <plugin>

            <groupId>org.apache.maven.plugins</groupId>

            <artifactId>maven-dependency-plugin</artifactId>

            <executions>

              <execution>

                <id>extract-foo</id>

                <goals>

                  <goal>unpack</goal>

                </goals>

                <configuration>

                  <artifactItems>

                    <artifactItem>

                      <groupId>com.kiva</groupId>

                      <artifactId>foo-core</artifactId>

                      <version>${project.version}</version>

                      <type>tar.bz2</type>

 
<outputDirectory>${project.build.directory}/foo</outputDirectory>

                    </artifactItem>

                  </artifactItems>

                </configuration>

              </execution>

            </executions>

        </plugin>

 





Then if you run the parent, when it gets to the integration tests, if
you have done at least mvn package, it will find the jar in the target
folder.

 

Given the above, when I run 'mvn integration-test' from the top-level
pom, I get the following, as if it was looking in my local or remote
repository for the tar.bz2. Since it already executed the package phase,
the tar.bz2 was correctly created however..

 

[INFO]
------------------------------------------------------------------------

[INFO] [dependency:unpack {execution: extract-mhs}]

[INFO] Configured Artifact:
com.kiva:foo-core:server:2.2.0-SNAPSHOT:tar.bz2

[INFO]
------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO]
------------------------------------------------------------------------

[INFO] Failed to resolve artifact.

 

GroupId: com.kiva

ArtifactId: foo-core

Version: 2.2.0-SNAPSHOT

 

Reason: Unable to download the artifact from any repository

 

Try downloading the file manually from the project website.

 

Then, install it using the command: 

    mvn install:install-file -DgroupId=com.kiva -DartifactId=foo-core
-Dversion=2.2.0-SNAPSHOT -Dclassifier=server -Dpackaging=tar.bz2
-Dfile=/path/to/file

 

Alternatively, if you host your own repository you can deploy the file
there: 

    mvn deploy:deploy-file -DgroupId=com.kiva -DartifactId=foo-core
-Dversion=2.2.0-SNAPSHOT -Dclassifier=server -Dpackaging=tar.bz2
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

 

 

I guess I'm missing one last step....

 

-Josh

 

 

         

        From: Joshua Pollak [mailto:[EMAIL PROTECTED] 
        Sent: Thursday, February 07, 2008 9:43 AM
        To: [email protected]
        Subject: [mojo-user] Integration testing a project?

         

        Hello,

         

        I have a project called foo with two modules, foo-core and
foo-integration-tests. foo-core outputs a tar.bz2 as its primary
artifact. I'd like to setup foo-integration-tests to extract this
artifact and run some tests on it via junit. 

         

        Currently I'm doing this by using the maven-dependency-plugin to
explicitly find the foo-core tar.bz2 snapshot artifact in the local
repository and extract it. But this requires manually running 'mvn
install' in the foo-core project.

         

        I'd like to be able to do 'mvn integration-test' from the upper
level 'uber-pom' directory, just called 'foo'.

         

        Can anyone help?

         

         

        -- 

        Joshua ChaitinPollak | Software Engineer 

        Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970

         

         

         

         

         

         

 

-- 

Joshua ChaitinPollak | Software Engineer 

Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970

 

 

 

 

 

 

 

-- 

Joshua ChaitinPollak | Software Engineer 

Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970

 

 

 

 

 

 

 

-- 

Joshua ChaitinPollak | Software Engineer 

Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970

 

 

 

 

 

 

Reply via email to