You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Joshua ChaitinPollak <jp...@kivasystems.com> on 2007/09/04 20:51:02 UTC
Project or module depends on assembly of another?
Hello,
I am trying to setup a project like this:
MyProj/
+-------pom.xml
+-------MyProj-Core/pom.xml
+-------MyProj-Integration-Tests/pom.xml
MyProj-Core and MyProj-Integration-Tests are both modules of and
MyProj. What I would like to do is setup MyProj-Integration-Tests so
that it will take the output of 'mvn package' from MyProj-Core,
unarchive it (install it) and run some tests on it.
Effectively, I'd like to create some tests that exercise our project
the same way they would be used when installed on a machine.
Is there a way to do this?
At a basic starting point, even with MyProj-Core being a dependancy
of MyProj-Integration-Tests, running 'mvn compile' in MyProj-
Integration-Tests doesn't trigger a build in MyProj-Core.
--
Joshua ChaitinPollak
Software Engineer
Kiva Systems
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Project or module depends on assembly of another?
Posted by Joshua ChaitinPollak <jp...@kivasystems.com>.
On Sep 5, 2007, at 10:31 AM, Wayne Fay wrote:
>> ok, so "mvn package" in core creates a target/MyProj-XXXX.tar.bz2
>> file.
>
> First, a question, why are you creating a tar.bz2 instead of a jar?
> Just wondering.
Our application has many additional files required in addition to the
jar, including shell scripts, configuration files, etc, in addition
to our 3rd party dependancies.
>
> I assume you are using assembly plugin to generate this tar.bz2
> file. If so, you should install this artifact into your repo. (Or
> you could throw away the normal way of doing things in Maven and
> just hard-code paths like ../core/target/MyProj-Core.tar.bz2. But I
> prefer to "mvn install" things.)
We do install the artifact into our local repo. The issue is that I'd
like to create a project that depends on this artifact, but takes
this artifact, extracts it, and runs tests against this extracted
archive.
>
> Tim just posted a sample config to attach assembly to your project
> lifecycle in this thread:
>
> From: Tim Kettler
> To: Maven Users List
> Subject: Re: Cannot deploy a parent 'tar.gz' assembly
> Date: Wed, 05 Sep 2007 10:00:09 +0200
I'll take a look at this.
--
Joshua ChaitinPollak
Software Engineer
Kiva Systems
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Project or module depends on assembly of another?
Posted by Wayne Fay <wa...@gmail.com>.
> ok, so "mvn package" in core creates a target/MyProj-XXXX.tar.bz2 file.
First, a question, why are you creating a tar.bz2 instead of a jar? Just wondering.
I assume you are using assembly plugin to generate this tar.bz2 file. If so, you should install this artifact into your repo. (Or you could throw away the normal way of doing things in Maven and just hard-code paths like ../core/target/MyProj-Core.tar.bz2. But I prefer to "mvn install" things.)
Tim just posted a sample config to attach assembly to your project lifecycle in this thread:
From: Tim Kettler
To: Maven Users List
Subject: Re: Cannot deploy a parent 'tar.gz' assembly
Date: Wed, 05 Sep 2007 10:00:09 +0200
> So what I'm looking for is a way for maven to take a tarball, and
> extract it to a known location before calling the integration-test
> phase. Heck, even a suggestion of how my Java code could get a handle
> on the path to the filename of a specific dependancy (MyProj-Core) so
> it would know what file to extract, would be a big help.
I would write a plugin. You should be able to do all this and more easily with a plugin as you can write the plugin in normal Java code, and Maven will automatically populate some fields for you (${localRepository} etc) which will help.
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Project or module depends on assembly of another?
Posted by Joshua ChaitinPollak <jp...@kivasystems.com>.
On Sep 4, 2007, at 3:20 PM, Wayne Fay wrote:
>> So what is the point of having modules at all? If you have to install
>> them anyway, why aren't they all just separate projects?
>
> For all intents, they are (completely) separate projects.
>
>> Ok, lets say I install the Core project, is there a way in my
>> Integration-Tests to get a filename for that project? Core creates a
>> tar.bz2 file, and my integration tests need to extract the tar.bz2 to
>> a temp directory, then run some programs and verify the expected
>> output.
>
> Explain this more, and perhaps we'll have some suggestions for how to
> handle it. How/when does "core create a tar.bz2 file" -- during
> compile, test, when? There are lots of things you can do with the
> assistance of buildhelper, assembly, and dependency plugins.
ok, so "mvn package" in core creates a target/MyProj-XXXX.tar.bz2 file.
In integration-test, I'd like to take this tar.bz2 file and do the
following (programmatically):
tar jxvf MyProj-Core.tar.bz2
MyProj-Core/bin/runProgram
And then validate the output of runProgram. Ideally, I would write
Java code (as a junit test) to call System.exec() which would monitor
MyProj-Core/bin/runProgram.
So what I'm looking for is a way for maven to take a tarball, and
extract it to a known location before calling the integration-test
phase. Heck, even a suggestion of how my Java code could get a handle
on the path to the filename of a specific dependancy (MyProj-Core) so
it would know what file to extract, would be a big help.
Does that explain what I'm trying to do?
Thanks,
Josh
--
Joshua ChaitinPollak
Software Engineer
Kiva Systems
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Project or module depends on assembly of another?
Posted by Wayne Fay <wa...@gmail.com>.
> So what is the point of having modules at all? If you have to install
> them anyway, why aren't they all just separate projects?
For all intents, they are (completely) separate projects.
> Ok, lets say I install the Core project, is there a way in my
> Integration-Tests to get a filename for that project? Core creates a
> tar.bz2 file, and my integration tests need to extract the tar.bz2 to
> a temp directory, then run some programs and verify the expected output.
Explain this more, and perhaps we'll have some suggestions for how to
handle it. How/when does "core create a tar.bz2 file" -- during
compile, test, when? There are lots of things you can do with the
assistance of buildhelper, assembly, and dependency plugins.
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Project or module depends on assembly of another?
Posted by Joshua ChaitinPollak <jp...@kivasystems.com>.
On Sep 4, 2007, at 3:05 PM, Wayne Fay wrote:
> You need to run "mvn install" to put the artifacts in your local cache
> from MyProj-Core. Then you can depend on it in
> MyProj-Integration-Tests (just like any other dependency) and it will
> pull the file out of the cache and use it during its own execution ie
> mvn test etc.
So what is the point of having modules at all? If you have to install
them anyway, why aren't they all just separate projects?
Ok, lets say I install the Core project, is there a way in my
Integration-Tests to get a filename for that project? Core creates a
tar.bz2 file, and my integration tests need to extract the tar.bz2 to
a temp directory, then run some programs and verify the expected output.
> As for calling "mvn compile" from a subproject and expecting that it
> will go build the parent and all modules, that's just not how Maven
> works. You can build from the top (parent) and get this kind of build,
> but not from modules themselves.
Poop.
--
Joshua ChaitinPollak
Software Engineer
Kiva Systems
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Project or module depends on assembly of another?
Posted by Wayne Fay <wa...@gmail.com>.
You need to run "mvn install" to put the artifacts in your local cache
from MyProj-Core. Then you can depend on it in
MyProj-Integration-Tests (just like any other dependency) and it will
pull the file out of the cache and use it during its own execution ie
mvn test etc.
As for calling "mvn compile" from a subproject and expecting that it
will go build the parent and all modules, that's just not how Maven
works. You can build from the top (parent) and get this kind of build,
but not from modules themselves.
Wayne
On 9/4/07, Joshua ChaitinPollak <jp...@kivasystems.com> wrote:
> Hello,
>
> I am trying to setup a project like this:
>
> MyProj/
> +-------pom.xml
> +-------MyProj-Core/pom.xml
> +-------MyProj-Integration-Tests/pom.xml
>
> MyProj-Core and MyProj-Integration-Tests are both modules of and
> MyProj. What I would like to do is setup MyProj-Integration-Tests so
> that it will take the output of 'mvn package' from MyProj-Core,
> unarchive it (install it) and run some tests on it.
>
> Effectively, I'd like to create some tests that exercise our project
> the same way they would be used when installed on a machine.
>
> Is there a way to do this?
>
> At a basic starting point, even with MyProj-Core being a dependancy
> of MyProj-Integration-Tests, running 'mvn compile' in MyProj-
> Integration-Tests doesn't trigger a build in MyProj-Core.
>
>
> --
> Joshua ChaitinPollak
> Software Engineer
> Kiva Systems
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org