You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nathan Coast <na...@codeczar.com> on 2006/11/27 20:04:45 UTC

multiple artefacts for a project?

Hi,

Is having multiple artefacts for a single project not allowed within 
Maven 2?  I have a number of projects which produce 2 related artefacts:

1) jar file containing hibernate pojos, hbm mappings etc.
2) sql script to create tables required by 1.

I'd rather not have 2 projects as all of the inputs for (2) are within 
(1) and it seems a little overkill to create a whole new project for a 
single generated sql file.

Is it possible to deploy multiple files to the same location in the repo?

/foo/bar/whatever/1.0/whatever-1.0.jar
/foo/bar/whatever/1.0/whatever-1.0.sql
/foo/bar/whatever/1.0/whatever-1.0.pom

cheers
Nathan


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


Re: multiple artefacts for a project?

Posted by Nathan Coast <na...@codeczar.com>.
Tom came back with the answer...

there's a classifier node in pom dependencies that does exactly what I 
needed.  The additional artefact is specified by build-helper-maven-plugin:

     <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>build-helper-maven-plugin</artifactId>
       <executions>
         <execution>
           <id>attach-artifacts</id>
           <phase>package</phase>
           <goals>
              <goal>attach-artifact</goal>
           </goals>
           <configuration>
             <artifacts>
               <artifact>
                 <file>some file</file>
                 <type>sql</type>
                 <classifier>create</classifier>
               </artifact>
             </artifact>
           </configuration>
         </execution>
       </executions>
     </plugin>

and then referenced as a dependency in another project:

         <dependency>
             <groupId>com.codeczar.config</groupId>
             <artifactId>config-model</artifactId>
             <type>sql</type>
             <classifier>create</classifier>
             <version>1.1-SNAPSHOT</version>
         </dependency>

cheers
Nathan

Nathan Coast wrote:
> Hi Tom,
> 
> thanks for your reply, from your hint I've made some good progress:
> 
>     <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>build-helper-maven-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>attach-artifacts</id>
>             <phase>package</phase>
>             <goals>
>               <goal>attach-artifact</goal>
>             </goals>
>             <configuration>
>                 <artifacts>
>                   <artifact> 
> <file>${project.basedir}/target/sql/${project.artifactId}-schema-create-${project.version}.sql</file> 
> 
>                     <type>sql</type>
>                     <classifier>create</classifier>
>                   </artifact>
>                   <artifact>
> <file>${project.basedir}/target/sql/${project.artifactId}-schema-drop-${project.version}.sql</file> 
> 
>                     <type>sql</type>
>                     <classifier>drop</classifier>
>                   </artifact>
>                 </artifacts>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
> 
> which results in two additional files installed in the repository.  I 
> guessed at using classifier to distinguish between create and drop, or 
> is this an abuse of the classifier attribute?
> 
> \com\codeczar\config\config-model\1.1-SNAPSHOT
>     config-model-1.1-SNAPSHOT-create.sql
>     config-model-1.1-SNAPSHOT-drop.sql
> 
> is it possible have these artefacts as dependencies for other projects?
> This fails .create.sql not -create.sql :(
>        <dependency>
>            <groupId>com.codeczar.config</groupId>
>            <artifactId>config-model</artifactId>
>            <type>create.sql</type>
>            <version>1.1-SNAPSHOT</version>        
>        </dependency>                  
> 
> cheers
> Nathan
> 
> Tom Huybrechts wrote:
>> See attach-artifact in the build-helper-maven plugin:
>> http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
>>
>> tom
>>
>>
>> On 11/27/06, Nathan Coast <na...@codeczar.com> wrote:
>>> Hi,
>>>
>>> Is having multiple artefacts for a single project not allowed within
>>> Maven 2?  I have a number of projects which produce 2 related artefacts:
>>>
>>> 1) jar file containing hibernate pojos, hbm mappings etc.
>>> 2) sql script to create tables required by 1.
>>>
>>> I'd rather not have 2 projects as all of the inputs for (2) are within
>>> (1) and it seems a little overkill to create a whole new project for a
>>> single generated sql file.
>>>
>>> Is it possible to deploy multiple files to the same location in the 
>>> repo?
>>>
>>> /foo/bar/whatever/1.0/whatever-1.0.jar
>>> /foo/bar/whatever/1.0/whatever-1.0.sql
>>> /foo/bar/whatever/1.0/whatever-1.0.pom
>>>
>>> cheers
>>> Nathan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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


Re: multiple artefacts for a project?

Posted by Mark Struberg <st...@yahoo.de>.
If you like to have multiple files packed together in
a zip and the zip should be handled as attached
artifact, you may also use the maven-assembly-plugin.

lg,
strub

--- Nathan Coast <na...@codeczar.com> schrieb:

> Hi Tom,
> 
> thanks for your reply, from your hint I've made some
> good progress:
> 
>      <plugin>
>          <groupId>org.codehaus.mojo</groupId>
>         
> <artifactId>build-helper-maven-plugin</artifactId>
>          <executions>
>            <execution>
>              <id>attach-artifacts</id>
>              <phase>package</phase>
>              <goals>
>                <goal>attach-artifact</goal>
>              </goals>
>              <configuration>
>                  <artifacts>
>                    <artifact> 
>
<file>${project.basedir}/target/sql/${project.artifactId}-schema-create-${project.version}.sql</file>
>                      <type>sql</type>
>                      <classifier>create</classifier>
>                    </artifact>
>                    <artifact>
>
<file>${project.basedir}/target/sql/${project.artifactId}-schema-drop-${project.version}.sql</file>
>                      <type>sql</type>
>                      <classifier>drop</classifier>
>                    </artifact>
>                  </artifacts>
>              </configuration>
>            </execution>
>          </executions>
>        </plugin>
> 
> which results in two additional files installed in
> the repository.  I 
> guessed at using classifier to distinguish between
> create and drop, or 
> is this an abuse of the classifier attribute?
> 
> \com\codeczar\config\config-model\1.1-SNAPSHOT
> 	config-model-1.1-SNAPSHOT-create.sql
> 	config-model-1.1-SNAPSHOT-drop.sql
> 
> is it possible have these artefacts as dependencies
> for other projects?
> This fails .create.sql not -create.sql :(
>     	<dependency>
>     		<groupId>com.codeczar.config</groupId>
>     		<artifactId>config-model</artifactId>
>     		<type>create.sql</type>
>     		<version>1.1-SNAPSHOT</version> 		
>     	</dependency>	   	    	
> 
> cheers
> Nathan
> 
> Tom Huybrechts wrote:
> > See attach-artifact in the build-helper-maven
> plugin:
> >
>
http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
> > 
> > tom
> > 
> > 
> > On 11/27/06, Nathan Coast <na...@codeczar.com>
> wrote:
> >> Hi,
> >>
> >> Is having multiple artefacts for a single project
> not allowed within
> >> Maven 2?  I have a number of projects which
> produce 2 related artefacts:
> >>
> >> 1) jar file containing hibernate pojos, hbm
> mappings etc.
> >> 2) sql script to create tables required by 1.
> >>
> >> I'd rather not have 2 projects as all of the
> inputs for (2) are within
> >> (1) and it seems a little overkill to create a
> whole new project for a
> >> single generated sql file.
> >>
> >> Is it possible to deploy multiple files to the
> same location in the repo?
> >>
> >> /foo/bar/whatever/1.0/whatever-1.0.jar
> >> /foo/bar/whatever/1.0/whatever-1.0.sql
> >> /foo/bar/whatever/1.0/whatever-1.0.pom
> >>
> >> cheers
> >> Nathan
> >>
> >>
> >>
>
---------------------------------------------------------------------
> >> 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
> > 
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org
> 
> 



		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

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


Re: multiple artefacts for a project?

Posted by Nathan Coast <na...@codeczar.com>.
Hi Tom,

thanks for your reply, from your hint I've made some good progress:

     <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
         <executions>
           <execution>
             <id>attach-artifacts</id>
             <phase>package</phase>
             <goals>
               <goal>attach-artifact</goal>
             </goals>
             <configuration>
                 <artifacts>
                   <artifact> 
<file>${project.basedir}/target/sql/${project.artifactId}-schema-create-${project.version}.sql</file>
                     <type>sql</type>
                     <classifier>create</classifier>
                   </artifact>
                   <artifact>
<file>${project.basedir}/target/sql/${project.artifactId}-schema-drop-${project.version}.sql</file>
                     <type>sql</type>
                     <classifier>drop</classifier>
                   </artifact>
                 </artifacts>
             </configuration>
           </execution>
         </executions>
       </plugin>

which results in two additional files installed in the repository.  I 
guessed at using classifier to distinguish between create and drop, or 
is this an abuse of the classifier attribute?

\com\codeczar\config\config-model\1.1-SNAPSHOT
	config-model-1.1-SNAPSHOT-create.sql
	config-model-1.1-SNAPSHOT-drop.sql

is it possible have these artefacts as dependencies for other projects?
This fails .create.sql not -create.sql :(
    	<dependency>
    		<groupId>com.codeczar.config</groupId>
    		<artifactId>config-model</artifactId>
    		<type>create.sql</type>
    		<version>1.1-SNAPSHOT</version> 		
    	</dependency>	   	    	

cheers
Nathan

Tom Huybrechts wrote:
> See attach-artifact in the build-helper-maven plugin:
> http://mojo.codehaus.org/build-helper-maven-plugin/howto.html
> 
> tom
> 
> 
> On 11/27/06, Nathan Coast <na...@codeczar.com> wrote:
>> Hi,
>>
>> Is having multiple artefacts for a single project not allowed within
>> Maven 2?  I have a number of projects which produce 2 related artefacts:
>>
>> 1) jar file containing hibernate pojos, hbm mappings etc.
>> 2) sql script to create tables required by 1.
>>
>> I'd rather not have 2 projects as all of the inputs for (2) are within
>> (1) and it seems a little overkill to create a whole new project for a
>> single generated sql file.
>>
>> Is it possible to deploy multiple files to the same location in the repo?
>>
>> /foo/bar/whatever/1.0/whatever-1.0.jar
>> /foo/bar/whatever/1.0/whatever-1.0.sql
>> /foo/bar/whatever/1.0/whatever-1.0.pom
>>
>> cheers
>> Nathan
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 


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


Re: multiple artefacts for a project?

Posted by Tom Huybrechts <to...@gmail.com>.
See attach-artifact in the build-helper-maven plugin:
http://mojo.codehaus.org/build-helper-maven-plugin/howto.html

tom


On 11/27/06, Nathan Coast <na...@codeczar.com> wrote:
> Hi,
>
> Is having multiple artefacts for a single project not allowed within
> Maven 2?  I have a number of projects which produce 2 related artefacts:
>
> 1) jar file containing hibernate pojos, hbm mappings etc.
> 2) sql script to create tables required by 1.
>
> I'd rather not have 2 projects as all of the inputs for (2) are within
> (1) and it seems a little overkill to create a whole new project for a
> single generated sql file.
>
> Is it possible to deploy multiple files to the same location in the repo?
>
> /foo/bar/whatever/1.0/whatever-1.0.jar
> /foo/bar/whatever/1.0/whatever-1.0.sql
> /foo/bar/whatever/1.0/whatever-1.0.pom
>
> cheers
> Nathan
>
>
> ---------------------------------------------------------------------
> 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


Re: multiple artefacts for a project?

Posted by Nathan Coast <na...@codeczar.com>.
rtfm to self :)

http://maven.apache.org/plugins/maven-assembly-plugin/

Nathan Coast wrote:
> Hi,
> 
> Is having multiple artefacts for a single project not allowed within 
> Maven 2?  I have a number of projects which produce 2 related artefacts:
> 
> 1) jar file containing hibernate pojos, hbm mappings etc.
> 2) sql script to create tables required by 1.
> 
> I'd rather not have 2 projects as all of the inputs for (2) are within 
> (1) and it seems a little overkill to create a whole new project for a 
> single generated sql file.
> 
> Is it possible to deploy multiple files to the same location in the repo?
> 
> /foo/bar/whatever/1.0/whatever-1.0.jar
> /foo/bar/whatever/1.0/whatever-1.0.sql
> /foo/bar/whatever/1.0/whatever-1.0.pom
> 
> cheers
> Nathan
> 
> 
> ---------------------------------------------------------------------
> 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