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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to