You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Pennebaker <ap...@42six.com> on 2013/10/31 16:00:52 UTC

How can I force a Maven task to depend on other Maven tasks?

When I run `mvn test`, I sometimes get misleading reports ("all unit tests
pass"), when in fact, upon manually recompiling the code with `mvn compile`
and running `mvn test` again, the new code shows test failures.

Is this normal behavior for a Maven project? How can I force a Maven task
to depend on other Maven tasks?

-- 
Cheers,

Andrew Pennebaker
apennebaker@42six.com

Re: How can I force a Maven task to depend on other Maven tasks?

Posted by George Wilson <rm...@gmail.com>.
Are you generating any reports using the spotfire plugin and/or perhaps
generating code coverage reports? Those have helped me identify whats going
on in the past. What you describe sounds like a dependency issue within
your modules. As others have mentioned, seeing a POM or some output would
help. Beyond that it is very difficult to speculate on what is going on.
Personally, I would try putting everything into an aggregator project and
see what happens. Perhaps run install instead of compile so update
compilation units are installed in your local repo. Those are the things I
would do.


On Thu, Oct 31, 2013 at 9:00 AM, Russell Gold <ru...@gold-family.us> wrote:

> No need to specify. Any plugins bound to generate-sources will run before
> the compile phase. Are you using custom plugins? Multiple modules?
>
> Maybe show us your pom?
>
> On Oct 31, 2013, at 11:23 AM, Andrew Pennebaker <ap...@42six.com>
> wrote:
>
> >> It sounds as though you might have intermittent tests.
> >
> >
> > Good guess, but no. In my case, I had refactored the arity of some
> > constructors, without updating all the code calling the constructors. On
> my
> > machine, `mvn test` showed everything passing. Wasn't until a coworker
> ran
> > `mvn test` on her computer that we saw a test failure.
> >
> > Also, on her computer, `mvn install` failed due to missing generated
> > sources. Would be nice if I could specify in the pom that the
> > `generate-sources` task is required before `mvn compile`.
> >
> > I'd like Maven tasks to work more like Make tasks, so that everything
> > downstream gets updated based on upstream file changes.
> >
> > --
> > Cheers,
> >
> > Andrew Pennebaker
> > apennebaker@42six.com
>
> -----------------
> Author, Getting Started with Apache Maven <
> http://www.packtpub.com/getting-started-with-apache-maven/video>
>
> Come read my webnovel, Take a Lemon <http://www.takealemon.com>,
> and listen to the Misfile radio play <
> http://www.fuzzyfacetheater.com/misfile/>!
>
>
>
>
>
>
>
>

Re: How can I force a Maven task to depend on other Maven tasks?

Posted by Russell Gold <ru...@gold-family.us>.
No need to specify. Any plugins bound to generate-sources will run before the compile phase. Are you using custom plugins? Multiple modules?

Maybe show us your pom?

On Oct 31, 2013, at 11:23 AM, Andrew Pennebaker <ap...@42six.com> wrote:

>> It sounds as though you might have intermittent tests.
> 
> 
> Good guess, but no. In my case, I had refactored the arity of some
> constructors, without updating all the code calling the constructors. On my
> machine, `mvn test` showed everything passing. Wasn't until a coworker ran
> `mvn test` on her computer that we saw a test failure.
> 
> Also, on her computer, `mvn install` failed due to missing generated
> sources. Would be nice if I could specify in the pom that the
> `generate-sources` task is required before `mvn compile`.
> 
> I'd like Maven tasks to work more like Make tasks, so that everything
> downstream gets updated based on upstream file changes.
> 
> -- 
> Cheers,
> 
> Andrew Pennebaker
> apennebaker@42six.com

-----------------
Author, Getting Started with Apache Maven <http://www.packtpub.com/getting-started-with-apache-maven/video>

Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.fuzzyfacetheater.com/misfile/>!








Re: How can I force a Maven task to depend on other Maven tasks?

Posted by Andrew Pennebaker <ap...@42six.com>.
> It sounds as though you might have intermittent tests.


Good guess, but no. In my case, I had refactored the arity of some
constructors, without updating all the code calling the constructors. On my
machine, `mvn test` showed everything passing. Wasn't until a coworker ran
`mvn test` on her computer that we saw a test failure.

Also, on her computer, `mvn install` failed due to missing generated
sources. Would be nice if I could specify in the pom that the
`generate-sources` task is required before `mvn compile`.

I'd like Maven tasks to work more like Make tasks, so that everything
downstream gets updated based on upstream file changes.

-- 
Cheers,

Andrew Pennebaker
apennebaker@42six.com

Re: How can I force a Maven task to depend on other Maven tasks?

Posted by Andrew Pennebaker <ap...@42six.com>.
> No such thing as a Maven task.
> Maven projects produce artifacts which other projects can declare as
> dependencies.
> You can have Maven projects that include sub-projects (multi-module
> project).
>
> Can you rephrase your question or describe what you are trying to do.
>

I would like to amend my pom so that the test *phase* depends on the
compile *phase*.

I'm certain that this dependency flow is already the default. It's just
weird to experience a `mvn test` passing when a manual `mvn compile`
produces compile errors.

-- 
Cheers,

Andrew Pennebaker
apennebaker@42six.com

Re: How can I force a Maven task to depend on other Maven tasks?

Posted by Ron Wheeler <rw...@artifact-software.com>.
No such thing as a Maven task.
Maven projects produce artifacts which other projects can declare as 
dependencies.
You can have Maven projects that include sub-projects (multi-module 
project).

Can you rephrase your question or describe what you are trying to do.

Bear in mind that Maven is used by tens of thousands of software 
development projects so that if you can describe what you want to do, 
someone will have already done it and can show you how.

Ron

On 31/10/2013 11:05 AM, Russell Gold wrote:
> ‘mvn test’ should compile any code that needs to be compiled. It sounds as though you might have intermittent tests. Can you show us a log of such a test run followed by a “compile test” run?
>
> - Russ
>
> On Oct 31, 2013, at 11:00 AM, Andrew Pennebaker <ap...@42six.com> wrote:
>
>> When I run `mvn test`, I sometimes get misleading reports ("all unit tests
>> pass"), when in fact, upon manually recompiling the code with `mvn compile`
>> and running `mvn test` again, the new code shows test failures.
>>
>> Is this normal behavior for a Maven project? How can I force a Maven task
>> to depend on other Maven tasks?
>>
>> -- 
>> Cheers,
>>
>> Andrew Pennebaker
>> apennebaker@42six.com
> -----------------
> Author, Getting Started with Apache Maven <http://www.packtpub.com/getting-started-with-apache-maven/video>
>
> Come read my webnovel, Take a Lemon <http://www.takealemon.com>,
> and listen to the Misfile radio play <http://www.fuzzyfacetheater.com/misfile/>!
>
>
>
>
>
>
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


Re: How can I force a Maven task to depend on other Maven tasks?

Posted by Russell Gold <ru...@gold-family.us>.
‘mvn test’ should compile any code that needs to be compiled. It sounds as though you might have intermittent tests. Can you show us a log of such a test run followed by a “compile test” run?

- Russ

On Oct 31, 2013, at 11:00 AM, Andrew Pennebaker <ap...@42six.com> wrote:

> When I run `mvn test`, I sometimes get misleading reports ("all unit tests
> pass"), when in fact, upon manually recompiling the code with `mvn compile`
> and running `mvn test` again, the new code shows test failures.
> 
> Is this normal behavior for a Maven project? How can I force a Maven task
> to depend on other Maven tasks?
> 
> -- 
> Cheers,
> 
> Andrew Pennebaker
> apennebaker@42six.com

-----------------
Author, Getting Started with Apache Maven <http://www.packtpub.com/getting-started-with-apache-maven/video>

Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.fuzzyfacetheater.com/misfile/>!