FAQ
Hi,

I have a maven project (Project 1) which is intended for executing
integration tests. Inside this project is an additional class that helps me
automate the deployment of various jars to a nexus repo.

Project 1 is dependent on those jars (SNAPSHOT).
Project 2 is dependent on those jars (SNAPSHOT).
Project 1 is also dependent on project 2. (SNAPSHOT).

STEP 1: My CI server (TeamCity) runs a daily build config called "Deploy
Jars" @ 4:00 AM on Project 1, with Maven phase: "pre-integration-test".

pre-integration-test runs a testNG suite that has the class for deploying
those jars to the repo. Works fine. Only that class runs.

STEP 2: Next, my CI server has a build trigger for project 2 (to compile and
deploy) to occur anytime "Deploy Jars" is successfully built. This works --
project 2 is built (and project 2 updated its SNAPSHOT dependencies on those
Jars that were sent to the repo in step 1). Project 2 is compiled and it's
.jar deployed to the repo as well.

STEP 3: Back to Project 1. Now that all the .jars have been uploaded to the
repo (various jars, including the .jar for project 2, as described in step
2), A Maven build is run with phase "integration-test".

THE PROBLEM:

Unfortunately when I do STEP 3, Maven ends up also RE-RUNNING
pre-integration test prior to integration-test, which basically reruns the
actions that already occurred in STEP 1. (i.e. all those jars are sent to
the repo again).

That probably makes sense, in that Maven is probably hardwired to run
"pre-integration-test" any time I ask it to run "integration-test".

I'd like to find a way out of this -- any suggestions? Is there another
maven "phase" I can take advantage of here, to accomplish my objective?
Basically, I don't want step 3 (integration-test) to re-copy those jars to
the repo, it's a waste of time, etc.

Thanks in advance!

Bonus question -- am I getting 'phase' and 'goal' mixed up? My POM file says
that "pre-integration-test" and "integration-test" are "phases". They both
have a "goal" of "test". But in my CI server, I have "pre-integration-test"
and "integration-test" listed as GOALS the maven build configuration on the
CI server, and that seems to be working (for the most part). In other words
the build configuration for STEP 1 only lists "pre-integration-test" for a
goal, and that works, but the POM file only lists "pre-integration-test" as
a "phase"...







--
View this message in context: http://maven.40175.n5.nabble.com/integration-test-testNG-and-a-CI-server-tp5726939.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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

Search Discussions

  • Baptiste Mathus at Oct 18, 2012 at 6:51 am
    Hi,
    Currently offline so I can't give you precise links now, but search Google
    for "maven lifecycle".

    What you encounter is normal and it's basically not possible to change it
    easily (I mean having the pre-integration-test not running before
    integration-test phase).

    Goals are things you can bind to phases. And some goals are actually bound
    by default to some phases of the different standard lifecycle.

    So I guess what you could do is running explicitly the goals you're
    interested in. But then you should be aware that explicitly running goals
    in the Maven world is actually not the typical case.

    Maven is about build standardization. People who want to build your project
    should not have to know the different necessary goals you need.

    If what you want is having a way to disable some parts of the build by
    default (or the contrary), then look at Maven profiles.

    Cheers
    Le 17 oct. 2012 15:40, "mlandman99" <mlandman99@gmail.com> a écrit :
    Hi,

    I have a maven project (Project 1) which is intended for executing
    integration tests. Inside this project is an additional class that helps me
    automate the deployment of various jars to a nexus repo.

    Project 1 is dependent on those jars (SNAPSHOT).
    Project 2 is dependent on those jars (SNAPSHOT).
    Project 1 is also dependent on project 2. (SNAPSHOT).

    STEP 1: My CI server (TeamCity) runs a daily build config called "Deploy
    Jars" @ 4:00 AM on Project 1, with Maven phase: "pre-integration-test".

    pre-integration-test runs a testNG suite that has the class for deploying
    those jars to the repo. Works fine. Only that class runs.

    STEP 2: Next, my CI server has a build trigger for project 2 (to compile
    and
    deploy) to occur anytime "Deploy Jars" is successfully built. This works --
    project 2 is built (and project 2 updated its SNAPSHOT dependencies on
    those
    Jars that were sent to the repo in step 1). Project 2 is compiled and it's
    .jar deployed to the repo as well.

    STEP 3: Back to Project 1. Now that all the .jars have been uploaded to the
    repo (various jars, including the .jar for project 2, as described in step
    2), A Maven build is run with phase "integration-test".

    THE PROBLEM:

    Unfortunately when I do STEP 3, Maven ends up also RE-RUNNING
    pre-integration test prior to integration-test, which basically reruns the
    actions that already occurred in STEP 1. (i.e. all those jars are sent to
    the repo again).

    That probably makes sense, in that Maven is probably hardwired to run
    "pre-integration-test" any time I ask it to run "integration-test".

    I'd like to find a way out of this -- any suggestions? Is there another
    maven "phase" I can take advantage of here, to accomplish my objective?
    Basically, I don't want step 3 (integration-test) to re-copy those jars to
    the repo, it's a waste of time, etc.

    Thanks in advance!

    Bonus question -- am I getting 'phase' and 'goal' mixed up? My POM file
    says
    that "pre-integration-test" and "integration-test" are "phases". They both
    have a "goal" of "test". But in my CI server, I have "pre-integration-test"
    and "integration-test" listed as GOALS the maven build configuration on the
    CI server, and that seems to be working (for the most part). In other words
    the build configuration for STEP 1 only lists "pre-integration-test" for a
    goal, and that works, but the POM file only lists "pre-integration-test" as
    a "phase"...







    --
    View this message in context:
    http://maven.40175.n5.nabble.com/integration-test-testNG-and-a-CI-server-tp5726939.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Christofer Dutz at Oct 18, 2012 at 8:48 am
    Hi,

    I guess what you want to do, is to have the daily build job build and deploy the latest jars without running the integration tests, am I correct?

    You then want to be able to run the integration tests without deploying first, am I correct?

    Well in that case I would suggest to tell the surefire plugin that is probably executing your integration tests to "skipTests" and have the jars deployed in the normal deploy phase of maven (Not using custom deploy code hidden in a Testcase).

    Then if you want to run the integration tests but don't want to deploy, you simply execute the "mvn package" without diabling the tests. So maven would execute the entire build (including integration tests) but stop at the package phase and not install or deploy anything.

    Chris



    ________________________________________
    Von: Baptiste Mathus [bmathus@gmail.com]
    Gesendet: Donnerstag, 18. Oktober 2012 08:50
    An: Maven Users List
    Betreff: Re: integration-test, testNG, and a CI server

    Hi,
    Currently offline so I can't give you precise links now, but search Google
    for "maven lifecycle".

    What you encounter is normal and it's basically not possible to change it
    easily (I mean having the pre-integration-test not running before
    integration-test phase).

    Goals are things you can bind to phases. And some goals are actually bound
    by default to some phases of the different standard lifecycle.

    So I guess what you could do is running explicitly the goals you're
    interested in. But then you should be aware that explicitly running goals
    in the Maven world is actually not the typical case.

    Maven is about build standardization. People who want to build your project
    should not have to know the different necessary goals you need.

    If what you want is having a way to disable some parts of the build by
    default (or the contrary), then look at Maven profiles.

    Cheers
    Le 17 oct. 2012 15:40, "mlandman99" <mlandman99@gmail.com> a écrit :
    Hi,

    I have a maven project (Project 1) which is intended for executing
    integration tests. Inside this project is an additional class that helps me
    automate the deployment of various jars to a nexus repo.

    Project 1 is dependent on those jars (SNAPSHOT).
    Project 2 is dependent on those jars (SNAPSHOT).
    Project 1 is also dependent on project 2. (SNAPSHOT).

    STEP 1: My CI server (TeamCity) runs a daily build config called "Deploy
    Jars" @ 4:00 AM on Project 1, with Maven phase: "pre-integration-test".

    pre-integration-test runs a testNG suite that has the class for deploying
    those jars to the repo. Works fine. Only that class runs.

    STEP 2: Next, my CI server has a build trigger for project 2 (to compile
    and
    deploy) to occur anytime "Deploy Jars" is successfully built. This works --
    project 2 is built (and project 2 updated its SNAPSHOT dependencies on
    those
    Jars that were sent to the repo in step 1). Project 2 is compiled and it's
    .jar deployed to the repo as well.

    STEP 3: Back to Project 1. Now that all the .jars have been uploaded to the
    repo (various jars, including the .jar for project 2, as described in step
    2), A Maven build is run with phase "integration-test".

    THE PROBLEM:

    Unfortunately when I do STEP 3, Maven ends up also RE-RUNNING
    pre-integration test prior to integration-test, which basically reruns the
    actions that already occurred in STEP 1. (i.e. all those jars are sent to
    the repo again).

    That probably makes sense, in that Maven is probably hardwired to run
    "pre-integration-test" any time I ask it to run "integration-test".

    I'd like to find a way out of this -- any suggestions? Is there another
    maven "phase" I can take advantage of here, to accomplish my objective?
    Basically, I don't want step 3 (integration-test) to re-copy those jars to
    the repo, it's a waste of time, etc.

    Thanks in advance!

    Bonus question -- am I getting 'phase' and 'goal' mixed up? My POM file
    says
    that "pre-integration-test" and "integration-test" are "phases". They both
    have a "goal" of "test". But in my CI server, I have "pre-integration-test"
    and "integration-test" listed as GOALS the maven build configuration on the
    CI server, and that seems to be working (for the most part). In other words
    the build configuration for STEP 1 only lists "pre-integration-test" for a
    goal, and that works, but the POM file only lists "pre-integration-test" as
    a "phase"...







    --
    View this message in context:
    http://maven.40175.n5.nabble.com/integration-test-testNG-and-a-CI-server-tp5726939.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmaven
postedOct 17, '12 at 1:40p
activeOct 18, '12 at 8:48a
posts3
users3
websitemaven.apache.org
irc#maven

People

Translate

site design / logo © 2021 Grokbase