You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Craig McDaniel <cp...@gmail.com> on 2005/08/17 18:16:13 UTC

m1: test goal running twice!

I am using Damage Control on my project to run automated builds. As
part of the automated build, I want to deploy a snapshot jar and build
the site. DC is therefore executing "maven clean jar:deploy-snapshot
site". Unfortunately, this causes the unit tests to execute twice,
once for jar:deploy and once for site. Is this the expected behavior?

-- 
Craig McDaniel

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


Re: m1: test goal running twice!

Posted by Craig McDaniel <cp...@gmail.com>.
OK, now when I run "maven -Dgoal=continuousintegration
multiproject:goal" it tries to run this goal on my root project which
has no unit tests and therefore it fails. I have my projects set up
like so:

root/project.xml
core/project.xml
misc/project.xml

Where misc and core extend ../root/project.xml. In
root/project.properties, I have the following:

maven.multiproject.basedir=${basedir}/../
maven.multiproject.includes=*/project.xml
maven.multiproject.excludes=root/project.xml

And yet, it tries to run "continuousintegration" on root and I think
it fails because there are no tests to run in root.

On 8/17/05, Emmanuel Schmitt <em...@gmail.com> wrote:
> For the 1.X branch, you can avoid to run tests twice using this kind
> of tip : http://jroller.com/page/carlossg?entry=maven_tips_and_tricks_avoid
> 
> Emmanuel Schmitt.
> 
> 2005/8/17, Jamie Bisotti <jb...@gmail.com>:
> > On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > > I am using Damage Control on my project to run automated builds. As
> > > part of the automated build, I want to deploy a snapshot jar and build
> > > the site. DC is therefore executing "maven clean jar:deploy-snapshot
> > > site". Unfortunately, this causes the unit tests to execute twice,
> > > once for jar:deploy and once for site. Is this the expected behavior?
> > >
> > > --
> > > Craig McDaniel
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > AFAIK, yes...for the 1.X branch at least.
> > --
> > Jamie Bisotti
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
Craig McDaniel

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


Re: m1: test goal running twice!

Posted by Craig McDaniel <cp...@gmail.com>.
I'm launching it from within the "root" project (man that name is
confusing, I need to change it). Here is the build section:

 <build>
    <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
    <unitTestSourceDirectory>${basedir}/src/test/java</unitTestSourceDirectory>
    <unitTest>
      <includes>
        <include>**/*Test.java</include>
      </includes>
      <resources>
        <resource>
          <directory>${basedir}/src/test/resources</directory>
        </resource>
      </resources>
    </unitTest>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
      </resource>
    </resources>
  </build>

Could it be failing because the source directories do not exist in the
"root" project?

On 8/17/05, Emmanuel Schmitt <em...@gmail.com> wrote:
> Defining the goal continuousintegration in the root/maven.xml should
> be sufficient to be used by all sub projects.
> 
> I have tested to run "continuousintegration" goal on a project without
> any unit tests and I have no error. Moreover, in the test plugin,
> maven.test.failure property seems not to be set to false by default.
> 
> Where do you launch the "maven multiproject:goal" command and what if
> the build section of the root project.xml ?
> 
> 2005/8/17, Craig McDaniel <cp...@gmail.com>:
> > OK, I did some experimenting and this is what I found out. If I put
> > the following goal in my root/maven.xml, the <fail> tag executes on
> > any project that has NO unit tests.
> >
> >     <goal name="continuousintegration">
> >         <attainGoal name="clean"/>
> >         <attainGoal name="site"/>
> >         <!-- avoid running tests again -->
> >         <j:if test="${maven.test.failure}">
> >             <fail message="There were test failures."/>
> >         </j:if>
> >         <j:set var="maven.test.skip" value="true"/>
> >         <attainGoal name="jar:deploy"/>
> >         <j:set var="maven.test.skip" value="false"/>
> >     </goal>
> >
> > To fix this, I had to add the following before the "site" goal:
> >
> >         <j:set var="maven.test.failure" value="false"/>
> >
> > I find the fact that maven.test.failure defaults to true a little
> > puzzling. How can there be test failures if no tests are run? Is there
> > anything wrong with what I've done? Does it somehow break some
> > accepted best practice use of maven?
> >
> > On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > > Wait a second...do I have to create a "continuousintegration" goal in
> > > every sub-project?
> > >
> > > On 8/17/05, Emmanuel Schmitt <em...@gmail.com> wrote:
> > > > For the 1.X branch, you can avoid to run tests twice using this kind
> > > > of tip : http://jroller.com/page/carlossg?entry=maven_tips_and_tricks_avoid
> > > >
> > > > Emmanuel Schmitt.
> > > >
> > > > 2005/8/17, Jamie Bisotti <jb...@gmail.com>:
> > > > > On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > > > > > I am using Damage Control on my project to run automated builds. As
> > > > > > part of the automated build, I want to deploy a snapshot jar and build
> > > > > > the site. DC is therefore executing "maven clean jar:deploy-snapshot
> > > > > > site". Unfortunately, this causes the unit tests to execute twice,
> > > > > > once for jar:deploy and once for site. Is this the expected behavior?
> > > > > >
> > > > > > --
> > > > > > Craig McDaniel
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > > > For additional commands, e-mail: users-help@maven.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > > AFAIK, yes...for the 1.X branch at least.
> > > > > --
> > > > > Jamie Bisotti
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > 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
> > > >
> > > >
> > >
> > >
> > > --
> > > Craig McDaniel
> > >
> >
> >
> > --
> > Craig McDaniel
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
Craig McDaniel

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


Re: m1: test goal running twice!

Posted by Emmanuel Schmitt <em...@gmail.com>.
Defining the goal continuousintegration in the root/maven.xml should
be sufficient to be used by all sub projects.

I have tested to run "continuousintegration" goal on a project without
any unit tests and I have no error. Moreover, in the test plugin,
maven.test.failure property seems not to be set to false by default.

Where do you launch the "maven multiproject:goal" command and what if
the build section of the root project.xml ?

2005/8/17, Craig McDaniel <cp...@gmail.com>:
> OK, I did some experimenting and this is what I found out. If I put
> the following goal in my root/maven.xml, the <fail> tag executes on
> any project that has NO unit tests.
> 
>     <goal name="continuousintegration">
>         <attainGoal name="clean"/>
>         <attainGoal name="site"/>
>         <!-- avoid running tests again -->
>         <j:if test="${maven.test.failure}">
>             <fail message="There were test failures."/>
>         </j:if>
>         <j:set var="maven.test.skip" value="true"/>
>         <attainGoal name="jar:deploy"/>
>         <j:set var="maven.test.skip" value="false"/>
>     </goal>
> 
> To fix this, I had to add the following before the "site" goal:
> 
>         <j:set var="maven.test.failure" value="false"/>
> 
> I find the fact that maven.test.failure defaults to true a little
> puzzling. How can there be test failures if no tests are run? Is there
> anything wrong with what I've done? Does it somehow break some
> accepted best practice use of maven?
> 
> On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > Wait a second...do I have to create a "continuousintegration" goal in
> > every sub-project?
> >
> > On 8/17/05, Emmanuel Schmitt <em...@gmail.com> wrote:
> > > For the 1.X branch, you can avoid to run tests twice using this kind
> > > of tip : http://jroller.com/page/carlossg?entry=maven_tips_and_tricks_avoid
> > >
> > > Emmanuel Schmitt.
> > >
> > > 2005/8/17, Jamie Bisotti <jb...@gmail.com>:
> > > > On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > > > > I am using Damage Control on my project to run automated builds. As
> > > > > part of the automated build, I want to deploy a snapshot jar and build
> > > > > the site. DC is therefore executing "maven clean jar:deploy-snapshot
> > > > > site". Unfortunately, this causes the unit tests to execute twice,
> > > > > once for jar:deploy and once for site. Is this the expected behavior?
> > > > >
> > > > > --
> > > > > Craig McDaniel
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > > For additional commands, e-mail: users-help@maven.apache.org
> > > > >
> > > > >
> > > >
> > > > AFAIK, yes...for the 1.X branch at least.
> > > > --
> > > > Jamie Bisotti
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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
> > >
> > >
> >
> >
> > --
> > Craig McDaniel
> >
> 
> 
> --
> Craig McDaniel
> 
> ---------------------------------------------------------------------
> 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: m1: test goal running twice!

Posted by Craig McDaniel <cp...@gmail.com>.
OK, I did some experimenting and this is what I found out. If I put
the following goal in my root/maven.xml, the <fail> tag executes on
any project that has NO unit tests.

    <goal name="continuousintegration">
        <attainGoal name="clean"/>
        <attainGoal name="site"/>
        <!-- avoid running tests again -->
        <j:if test="${maven.test.failure}">
            <fail message="There were test failures."/>
        </j:if>
        <j:set var="maven.test.skip" value="true"/>
        <attainGoal name="jar:deploy"/>
        <j:set var="maven.test.skip" value="false"/>
    </goal>

To fix this, I had to add the following before the "site" goal:
    
        <j:set var="maven.test.failure" value="false"/>

I find the fact that maven.test.failure defaults to true a little
puzzling. How can there be test failures if no tests are run? Is there
anything wrong with what I've done? Does it somehow break some
accepted best practice use of maven?

On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> Wait a second...do I have to create a "continuousintegration" goal in
> every sub-project?
> 
> On 8/17/05, Emmanuel Schmitt <em...@gmail.com> wrote:
> > For the 1.X branch, you can avoid to run tests twice using this kind
> > of tip : http://jroller.com/page/carlossg?entry=maven_tips_and_tricks_avoid
> >
> > Emmanuel Schmitt.
> >
> > 2005/8/17, Jamie Bisotti <jb...@gmail.com>:
> > > On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > > > I am using Damage Control on my project to run automated builds. As
> > > > part of the automated build, I want to deploy a snapshot jar and build
> > > > the site. DC is therefore executing "maven clean jar:deploy-snapshot
> > > > site". Unfortunately, this causes the unit tests to execute twice,
> > > > once for jar:deploy and once for site. Is this the expected behavior?
> > > >
> > > > --
> > > > Craig McDaniel
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> > > AFAIK, yes...for the 1.X branch at least.
> > > --
> > > Jamie Bisotti
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
> 
> 
> --
> Craig McDaniel
> 


-- 
Craig McDaniel

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


Re: m1: test goal running twice!

Posted by Craig McDaniel <cp...@gmail.com>.
Wait a second...do I have to create a "continuousintegration" goal in
every sub-project?

On 8/17/05, Emmanuel Schmitt <em...@gmail.com> wrote:
> For the 1.X branch, you can avoid to run tests twice using this kind
> of tip : http://jroller.com/page/carlossg?entry=maven_tips_and_tricks_avoid
> 
> Emmanuel Schmitt.
> 
> 2005/8/17, Jamie Bisotti <jb...@gmail.com>:
> > On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > > I am using Damage Control on my project to run automated builds. As
> > > part of the automated build, I want to deploy a snapshot jar and build
> > > the site. DC is therefore executing "maven clean jar:deploy-snapshot
> > > site". Unfortunately, this causes the unit tests to execute twice,
> > > once for jar:deploy and once for site. Is this the expected behavior?
> > >
> > > --
> > > Craig McDaniel
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > AFAIK, yes...for the 1.X branch at least.
> > --
> > Jamie Bisotti
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
Craig McDaniel

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


Re: m1: test goal running twice!

Posted by Emmanuel Schmitt <em...@gmail.com>.
For the 1.X branch, you can avoid to run tests twice using this kind
of tip : http://jroller.com/page/carlossg?entry=maven_tips_and_tricks_avoid

Emmanuel Schmitt.

2005/8/17, Jamie Bisotti <jb...@gmail.com>:
> On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> > I am using Damage Control on my project to run automated builds. As
> > part of the automated build, I want to deploy a snapshot jar and build
> > the site. DC is therefore executing "maven clean jar:deploy-snapshot
> > site". Unfortunately, this causes the unit tests to execute twice,
> > once for jar:deploy and once for site. Is this the expected behavior?
> >
> > --
> > Craig McDaniel
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 
> AFAIK, yes...for the 1.X branch at least.
> --
> Jamie Bisotti
> 
> ---------------------------------------------------------------------
> 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: m1: test goal running twice!

Posted by Jamie Bisotti <jb...@gmail.com>.
On 8/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> I am using Damage Control on my project to run automated builds. As
> part of the automated build, I want to deploy a snapshot jar and build
> the site. DC is therefore executing "maven clean jar:deploy-snapshot
> site". Unfortunately, this causes the unit tests to execute twice,
> once for jar:deploy and once for site. Is this the expected behavior?
> 
> --
> Craig McDaniel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

AFAIK, yes...for the 1.X branch at least.
-- 
Jamie Bisotti

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