You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by Karl Wright <da...@gmail.com> on 2011/08/09 14:33:21 UTC

Does anyone know enough about maven to answer one simple question?

The maven files use the maven-dependency-plugin to copy wars out of
the repository into a place where testing and execution code can find
them.  This currently requires a build-time dependency, but in fact
the wars are not needed unless a test is being run.  I would like to
somehow set the scope of the code that copies the wars so that the
copy only takes place when "test" or "runtime" is the scope.  Is there
any way to do that?

Here's the plugin invocation:

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
           <execution>
            <id>copy-war</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <outputDirectory>target/dependency</outputDirectory>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.chemistry.opencmis</groupId>

<artifactId>chemistry-opencmis-server-inmemory-war</artifactId>
                  <version>0.5.0-SNAPSHOT</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>mcf-api-service</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>mcf-authority-service</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>mcf-crawler-ui</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>


Karl

Re: Does anyone know enough about maven to answer one simple question?

Posted by Piergiorgio Lucidi <pi...@gmail.com>.
Hi Karl,

this message just to recap the informations we have talked about during the
chat session.

Here we have an execution of tests based on some Maven artifacts that must
be generated using an execution of the install phase of Maven.
Maven has it own lifecycle that consists of phases that are executed in a
specific order, you can see the complete list here [1].

This means that to allow in our process to have the availability of the new
artifacts, before executing tests, we need to execute maven with the
following command:

mvn clean install

The install phase of Maven, as you can see in the page [1], include the
execution of generate-resource phase and test phase, so I think that this is
the correct way to build and execute tests for the project.

[1] -
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference

2011/8/9 Karl Wright <da...@gmail.com>

> A related question: when I run "mvn clean test" I get the following:
>
> >>>>>>
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-dependency-plugin:
> 2.1:copy (copy-war) on project mcf-jettyrunner: Error copying artifact from
> C:\w
> ip\mcf\trunk\framework\api-service\target\classes to
> C:\wip\mcf\trunk\framework\
> jetty-runner\target\dependency\classes: File
> C:\wip\mcf\trunk\framework\api-serv
> ice\target\classes does not exist -> [Help 1]
> <<<<<<
>
> This is coming from mcf-jettyrunner, which has dependencies on the
> api-service, crawler-ui, and authority-service wars.  These components
> seem to build properly:
>
> >>>>>>
> [INFO] ManifoldCF ........................................ SUCCESS [0.003s]
> [INFO] ManifoldCF - Framework ............................ SUCCESS [0.001s]
> [INFO] ManifoldCF - Framework - Core ..................... SUCCESS [2.864s]
> [INFO] ManifoldCF - Framework - UI Core .................. SUCCESS [0.678s]
> [INFO] ManifoldCF - Framework - Agents ................... SUCCESS
> [15.180s]
> [INFO] ManifoldCF - Framework - Pull Agent ............... SUCCESS
> [33.034s]
> [INFO] ManifoldCF - Framework - Authority Servlet ........ SUCCESS [0.832s]
> [INFO] ManifoldCF - Framework - API Servlet .............. SUCCESS [2.039s]
> [INFO] ManifoldCF - Framework - Authority Service ........ SUCCESS [0.114s]
> [INFO] ManifoldCF - Framework - API Service .............. SUCCESS [0.083s]
> [INFO] ManifoldCF - Framework - Crawler UI ............... SUCCESS [0.088s]
> [INFO] ManifoldCF - Connectors ........................... SUCCESS [0.001s]
> [INFO] ManifoldCF - Connectors - Active Directory ........ SUCCESS [0.815s]
> [INFO] ManifoldCF - Connectors - Filesystem .............. SUCCESS
> [26.844s]
> [INFO] ManifoldCF - Connectors - MetaCarta GTS ........... SUCCESS [1.093s]
> [INFO] ManifoldCF - Connectors - jCIFS ................... SUCCESS [1.028s]
> [INFO] ManifoldCF - Connectors - JDBC .................... SUCCESS [1.362s]
> [INFO] ManifoldCF - Connectors - Null Authority .......... SUCCESS [0.643s]
> [INFO] ManifoldCF - Connectors - Null Output ............. SUCCESS [0.566s]
> [INFO] ManifoldCF - Connectors - RSS ..................... SUCCESS [1.401s]
> [INFO] ManifoldCF - Connectors - Solr .................... SUCCESS [1.037s]
> [INFO] ManifoldCF - Connectors - Web ..................... SUCCESS [1.624s]
> [INFO] ManifoldCF - Connectors - CMIS .................... SUCCESS
> [32.040s]
> [INFO] ManifoldCF - Framework - Jetty Runner ............. FAILURE [0.466s]
> <<<<<<
>
> ... but they don't seem to be available in the repository after they
> are built during the test run.  Yet the dependencies don't stop the
> tests from trying to execute and copy those wars from the repository.
> Can anyone enlighten me as to why this might be?
>
> Karl
>
> On Tue, Aug 9, 2011 at 8:33 AM, Karl Wright <da...@gmail.com> wrote:
> > The maven files use the maven-dependency-plugin to copy wars out of
> > the repository into a place where testing and execution code can find
> > them.  This currently requires a build-time dependency, but in fact
> > the wars are not needed unless a test is being run.  I would like to
> > somehow set the scope of the code that copies the wars so that the
> > copy only takes place when "test" or "runtime" is the scope.  Is there
> > any way to do that?
> >
> > Here's the plugin invocation:
> >
> >      <plugin>
> >        <artifactId>maven-dependency-plugin</artifactId>
> >        <executions>
> >           <execution>
> >            <id>copy-war</id>
> >            <phase>generate-resources</phase>
> >            <goals>
> >              <goal>copy</goal>
> >            </goals>
> >            <configuration>
> >              <outputDirectory>target/dependency</outputDirectory>
> >              <artifactItems>
> >                <artifactItem>
> >                  <groupId>org.apache.chemistry.opencmis</groupId>
> >
> > <artifactId>chemistry-opencmis-server-inmemory-war</artifactId>
> >                  <version>0.5.0-SNAPSHOT</version>
> >                  <type>war</type>
> >                  <overWrite>false</overWrite>
> >                </artifactItem>
> >                <artifactItem>
> >                  <groupId>${project.groupId}</groupId>
> >                  <artifactId>mcf-api-service</artifactId>
> >                  <version>${project.version}</version>
> >                  <type>war</type>
> >                  <overWrite>false</overWrite>
> >                </artifactItem>
> >                <artifactItem>
> >                  <groupId>${project.groupId}</groupId>
> >                  <artifactId>mcf-authority-service</artifactId>
> >                  <version>${project.version}</version>
> >                  <type>war</type>
> >                  <overWrite>false</overWrite>
> >                </artifactItem>
> >                <artifactItem>
> >                  <groupId>${project.groupId}</groupId>
> >                  <artifactId>mcf-crawler-ui</artifactId>
> >                  <version>${project.version}</version>
> >                  <type>war</type>
> >                  <overWrite>false</overWrite>
> >                </artifactItem>
> >              </artifactItems>
> >            </configuration>
> >          </execution>
> >        </executions>
> >      </plugin>
> >
> >
> > Karl
> >
>



-- 
Piergiorgio Lucidi
Web: http://about.me/piergiorgiolucidi

Re: Does anyone know enough about maven to answer one simple question?

Posted by Karl Wright <da...@gmail.com>.
A related question: when I run "mvn clean test" I get the following:

>>>>>>
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:
2.1:copy (copy-war) on project mcf-jettyrunner: Error copying artifact from C:\w
ip\mcf\trunk\framework\api-service\target\classes to C:\wip\mcf\trunk\framework\
jetty-runner\target\dependency\classes: File C:\wip\mcf\trunk\framework\api-serv
ice\target\classes does not exist -> [Help 1]
<<<<<<

This is coming from mcf-jettyrunner, which has dependencies on the
api-service, crawler-ui, and authority-service wars.  These components
seem to build properly:

>>>>>>
[INFO] ManifoldCF ........................................ SUCCESS [0.003s]
[INFO] ManifoldCF - Framework ............................ SUCCESS [0.001s]
[INFO] ManifoldCF - Framework - Core ..................... SUCCESS [2.864s]
[INFO] ManifoldCF - Framework - UI Core .................. SUCCESS [0.678s]
[INFO] ManifoldCF - Framework - Agents ................... SUCCESS [15.180s]
[INFO] ManifoldCF - Framework - Pull Agent ............... SUCCESS [33.034s]
[INFO] ManifoldCF - Framework - Authority Servlet ........ SUCCESS [0.832s]
[INFO] ManifoldCF - Framework - API Servlet .............. SUCCESS [2.039s]
[INFO] ManifoldCF - Framework - Authority Service ........ SUCCESS [0.114s]
[INFO] ManifoldCF - Framework - API Service .............. SUCCESS [0.083s]
[INFO] ManifoldCF - Framework - Crawler UI ............... SUCCESS [0.088s]
[INFO] ManifoldCF - Connectors ........................... SUCCESS [0.001s]
[INFO] ManifoldCF - Connectors - Active Directory ........ SUCCESS [0.815s]
[INFO] ManifoldCF - Connectors - Filesystem .............. SUCCESS [26.844s]
[INFO] ManifoldCF - Connectors - MetaCarta GTS ........... SUCCESS [1.093s]
[INFO] ManifoldCF - Connectors - jCIFS ................... SUCCESS [1.028s]
[INFO] ManifoldCF - Connectors - JDBC .................... SUCCESS [1.362s]
[INFO] ManifoldCF - Connectors - Null Authority .......... SUCCESS [0.643s]
[INFO] ManifoldCF - Connectors - Null Output ............. SUCCESS [0.566s]
[INFO] ManifoldCF - Connectors - RSS ..................... SUCCESS [1.401s]
[INFO] ManifoldCF - Connectors - Solr .................... SUCCESS [1.037s]
[INFO] ManifoldCF - Connectors - Web ..................... SUCCESS [1.624s]
[INFO] ManifoldCF - Connectors - CMIS .................... SUCCESS [32.040s]
[INFO] ManifoldCF - Framework - Jetty Runner ............. FAILURE [0.466s]
<<<<<<

... but they don't seem to be available in the repository after they
are built during the test run.  Yet the dependencies don't stop the
tests from trying to execute and copy those wars from the repository.
Can anyone enlighten me as to why this might be?

Karl

On Tue, Aug 9, 2011 at 8:33 AM, Karl Wright <da...@gmail.com> wrote:
> The maven files use the maven-dependency-plugin to copy wars out of
> the repository into a place where testing and execution code can find
> them.  This currently requires a build-time dependency, but in fact
> the wars are not needed unless a test is being run.  I would like to
> somehow set the scope of the code that copies the wars so that the
> copy only takes place when "test" or "runtime" is the scope.  Is there
> any way to do that?
>
> Here's the plugin invocation:
>
>      <plugin>
>        <artifactId>maven-dependency-plugin</artifactId>
>        <executions>
>           <execution>
>            <id>copy-war</id>
>            <phase>generate-resources</phase>
>            <goals>
>              <goal>copy</goal>
>            </goals>
>            <configuration>
>              <outputDirectory>target/dependency</outputDirectory>
>              <artifactItems>
>                <artifactItem>
>                  <groupId>org.apache.chemistry.opencmis</groupId>
>
> <artifactId>chemistry-opencmis-server-inmemory-war</artifactId>
>                  <version>0.5.0-SNAPSHOT</version>
>                  <type>war</type>
>                  <overWrite>false</overWrite>
>                </artifactItem>
>                <artifactItem>
>                  <groupId>${project.groupId}</groupId>
>                  <artifactId>mcf-api-service</artifactId>
>                  <version>${project.version}</version>
>                  <type>war</type>
>                  <overWrite>false</overWrite>
>                </artifactItem>
>                <artifactItem>
>                  <groupId>${project.groupId}</groupId>
>                  <artifactId>mcf-authority-service</artifactId>
>                  <version>${project.version}</version>
>                  <type>war</type>
>                  <overWrite>false</overWrite>
>                </artifactItem>
>                <artifactItem>
>                  <groupId>${project.groupId}</groupId>
>                  <artifactId>mcf-crawler-ui</artifactId>
>                  <version>${project.version}</version>
>                  <type>war</type>
>                  <overWrite>false</overWrite>
>                </artifactItem>
>              </artifactItems>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>
>
> Karl
>