You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dennis Lundberg <de...@apache.org> on 2009/12/18 22:29:38 UTC

Sharing files between modules within the same project, for use by sql-maven-plugin

Hi

I'm facing a problem sharing files between modules. We have a multi
module build where several of the modules have database tests that use
the sql-maven-plugin to set up a test database.

These modules needs to share two files: a DDL file that creates the
tables and an SQL file that populates the tables. We don't want to have
multiple copies of these files in different modules, for obvious reasons.

After browsing the web for examples of sharing resources between
modules, I tried one where you put the files to be shared in a new
module. They go into the directory src/main/resources. Then each module
that needs the files just adds a dependency on the new module.

The problem with that approach is that the files are then class path
resources, which the sql-maven-plugin is not able to see. It seems to
only be able use files within the current module.

Is there another way we can do this?

Would it be possible to patch the sql-maven-plugin to be able to read
class path resources as files? Are there any examples of other plugins
that do this?

-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Sharing files between modules within the same project, for use by sql-maven-plugin

Posted by Dennis Lundberg <de...@apache.org>.
Thanks Roland!

That worked like a charm.

Roland Asmann wrote:
> Hi,
> 
> I guess you could patch the sql-plugin, but maybe you should use the
> maven-dependency-plugin[1] to unpack your new module for the tests. Then
> the sql-plugin can just read the unpacked file and you don't need to patch
> anything.
> 
> [1] http://maven.apache.org/plugins/maven-dependency-plugin/unpack-mojo.html
> 
> Roland
> 
> 
>> Hi
>>
>> I'm facing a problem sharing files between modules. We have a multi
>> module build where several of the modules have database tests that use
>> the sql-maven-plugin to set up a test database.
>>
>> These modules needs to share two files: a DDL file that creates the
>> tables and an SQL file that populates the tables. We don't want to have
>> multiple copies of these files in different modules, for obvious reasons.
>>
>> After browsing the web for examples of sharing resources between
>> modules, I tried one where you put the files to be shared in a new
>> module. They go into the directory src/main/resources. Then each module
>> that needs the files just adds a dependency on the new module.
>>
>> The problem with that approach is that the files are then class path
>> resources, which the sql-maven-plugin is not able to see. It seems to
>> only be able use files within the current module.
>>
>> Is there another way we can do this?
>>
>> Would it be possible to patch the sql-maven-plugin to be able to read
>> class path resources as files? Are there any examples of other plugins
>> that do this?
>>
>> --
>> Dennis Lundberg
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Sharing files between modules within the same project, for use by sql-maven-plugin

Posted by Roland Asmann <Ro...@cfc.at>.
Hi,

I guess you could patch the sql-plugin, but maybe you should use the
maven-dependency-plugin[1] to unpack your new module for the tests. Then
the sql-plugin can just read the unpacked file and you don't need to patch
anything.

[1] http://maven.apache.org/plugins/maven-dependency-plugin/unpack-mojo.html

Roland


> Hi
>
> I'm facing a problem sharing files between modules. We have a multi
> module build where several of the modules have database tests that use
> the sql-maven-plugin to set up a test database.
>
> These modules needs to share two files: a DDL file that creates the
> tables and an SQL file that populates the tables. We don't want to have
> multiple copies of these files in different modules, for obvious reasons.
>
> After browsing the web for examples of sharing resources between
> modules, I tried one where you put the files to be shared in a new
> module. They go into the directory src/main/resources. Then each module
> that needs the files just adds a dependency on the new module.
>
> The problem with that approach is that the files are then class path
> resources, which the sql-maven-plugin is not able to see. It seems to
> only be able use files within the current module.
>
> Is there another way we can do this?
>
> Would it be possible to patch the sql-maven-plugin to be able to read
> class path resources as files? Are there any examples of other plugins
> that do this?
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> 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