Re: Running integration tests
Then all I ask is you pay your newfound enlightenment forward... With this information you can answer some maven newbie questions on the M/L On Wednesday, 8 October 2014, Robert Mark Bram robertmarkb...@gmail.com wrote: Thank you Stephen - this was very useful and came just when I am ready to start piecing together this level of detail. 1) Default vs non-default plugins suddenly a White Rabbit with pink eyes ran close by Alice So, what I understood from this trip down the rabbit-hole. - Maven defines various lifecycles. - Each lifecycle defines a list of phases. - Each phase will execute a list of goals (defined in plugins). - What specific goals get executed in each phase depends on the packaging defined for the pom.xml. Generally package defines what sort of artifact you are dealing with: jar, war, ear etc. - I am using ear packaging, so it binds the surefire:test goal to the test phase, but binds nothing to integration-test - which is why I need to add the failsafe plugin to my pom.xml. I didn't need to define a phase for it, because failsafe's default phase is integration-test. 2) Just run integration tests? I can see that unit tests are all classes with names like *Test.java and integration tests are all classes with names like IT.java. But mvn verify and mvn test seem to run all tests (unit and integrations). Is there a way to run just one or the other? So, going from the previous trip down the rabbit hole, I understand that when I run mvn verify I was seeing unit tests and integration tests being run because in order to get to the verify phase (where my integration tests should run from), it was running every phase before that - including the test phase (where unit tests are run). tweaking of http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#skipTests should get you there! When I was running mvn test, I was also seeing integration tests being run because I had named my integration test classes TestBlahBlahIt.java so they were being picked up by both the test and integration-test phases. So, I should more strictly follow the convention of - unit tests being Test*.java - and NOT including IT at the end. - integration tests being *.IT.java - and NOT starting with Test. Or start with IT So failsafe will pickup ITblahblah.java BlahblahIT.java And a third form that I forget 3) Run integration tests after compile? The real reason for question 2 is that I wish to run integration tests only after I have deployed the new application to ensure the integration tests run on the server with the new content. Is there a way to do this? Sounds like you should consult my answer to a related question: http://stackoverflow.com/questions/16935290/maven-deploy-webapp-to-tomcat-before-junit-test/16936585#16936585 OK, this was very helpful too. In this case, I am working with a multi-module project and I decided it was best to add our selenium tests in a new project to keep them away from other project code. We have 13 pom.xml files, not counting the one I am adding. So this is my next challenge, to ensure I get this project executing after the others have done their job and deployed to the app server. Dependencies will ensure sequencing of modules Why, sometimes I've believed as many as five impossible things before after-noon tea. Time for one more before I knock off at 5pm. Rob :) - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org javascript:; For additional commands, e-mail: users-h...@maven.apache.org javascript:; -- Sent from my phone
Re: Running integration tests
So failsafe will pickup ITblahblah.java BlahblahIT.java And a third form that I forget *ITCase.java http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#includes /Anders 3) Run integration tests after compile? The real reason for question 2 is that I wish to run integration tests only after I have deployed the new application to ensure the integration tests run on the server with the new content. Is there a way to do this? Sounds like you should consult my answer to a related question: http://stackoverflow.com/questions/16935290/maven-deploy-webapp-to-tomcat-before-junit-test/16936585#16936585 OK, this was very helpful too. In this case, I am working with a multi-module project and I decided it was best to add our selenium tests in a new project to keep them away from other project code. We have 13 pom.xml files, not counting the one I am adding. So this is my next challenge, to ensure I get this project executing after the others have done their job and deployed to the app server. Dependencies will ensure sequencing of modules Why, sometimes I've believed as many as five impossible things before after-noon tea. Time for one more before I knock off at 5pm. Rob :) - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org javascript:; For additional commands, e-mail: users-h...@maven.apache.org javascript:; -- Sent from my phone
Re: Running integration tests
Thanks Anders... It can be hard to look that stuff on the phone... I remember wanting to have a symmetry with the Surefire patterns of Test*.java; *Test.java; *TestCase.java but I couldn't recall what I did for the last one! On 8 October 2014 07:19, Anders Hammar and...@hammar.net wrote: So failsafe will pickup ITblahblah.java BlahblahIT.java And a third form that I forget *ITCase.java http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#includes /Anders 3) Run integration tests after compile? The real reason for question 2 is that I wish to run integration tests only after I have deployed the new application to ensure the integration tests run on the server with the new content. Is there a way to do this? Sounds like you should consult my answer to a related question: http://stackoverflow.com/questions/16935290/maven-deploy-webapp-to-tomcat-before-junit-test/16936585#16936585 OK, this was very helpful too. In this case, I am working with a multi-module project and I decided it was best to add our selenium tests in a new project to keep them away from other project code. We have 13 pom.xml files, not counting the one I am adding. So this is my next challenge, to ensure I get this project executing after the others have done their job and deployed to the app server. Dependencies will ensure sequencing of modules Why, sometimes I've believed as many as five impossible things before after-noon tea. Time for one more before I knock off at 5pm. Rob :) - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org javascript:; For additional commands, e-mail: users-h...@maven.apache.org javascript:; -- Sent from my phone
Re: maven deploy artifacts to Nexus repository
I decided to start using HTTP/HTTPS instead of SCP for uploading and downloading artefacts from my Nexus server. However switching the URL didn't work. I have created a user in Nexus called build. In my settings.xml I have the following configuration taken from http://books.sonatype.com/nexus-book/reference/maven-sect-single-group.html server idnexus/id usernamebuild/username passwordXXX/password /server mirror idnexus/id mirrorOf*/mirrorOf urlhttp://maven-vm1:8081/nexus/content/groups/public/url /mirror profile idnexus/id repositories repository idcentral/id urlhttp://central/url releases enabledtrue/enabled updatePolicyalways/updatePolicy /releases snapshots enabledtrue/enabled updatePolicyalways/updatePolicy /snapshots /repository /repositories pluginRepositories pluginRepository idcentral/id urlhttp://central/url releases enabledtrue/enabled /releases snapshots enabledtrue/enabled /snapshots /pluginRepository /pluginRepositories /profile activeProfiles activeProfilenexus/activeProfile /activeProfiles In my pom.xml I changed the following in distributionManagement urlscp://maven-vm1/srv/maven/snapshots/url to urlhttp://maven-vm1:8081/nexus/content/repositories/snapshots/url Still I cannot get it to upload to Nexus: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project MyApp: Failed to deploy artifacts: Could not transfer artifact no.company:MyApp:jar:2.5.1-20141008.085615-1 from/to snapshots (http://maven-vm1:8081/nexus/content/repositories/snapshots): Failed to transfer file: http://maven-vm1:8081/nexus/content/repositories/snapshots/no/company/MyApp/2.5.1-SNAPSHOT/MyApp-2.5.1-20141008.085615-1.jar. Return code is: 401, ReasonPhrase: Unauthorized. - [Help 1] -- View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808056.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: maven deploy artifacts to Nexus repository
What's the id defined in the distributionMgmt section? It should map to the id for the server creds defined in settings.xml ('nexus'). /Anders On Wed, Oct 8, 2014 at 11:14 AM, DJViking sverre@gmail.com wrote: I decided to start using HTTP/HTTPS instead of SCP for uploading and downloading artefacts from my Nexus server. However switching the URL didn't work. I have created a user in Nexus called build. In my settings.xml I have the following configuration taken from http://books.sonatype.com/nexus-book/reference/maven-sect-single-group.html server idnexus/id usernamebuild/username passwordXXX/password /server mirror idnexus/id mirrorOf*/mirrorOf urlhttp://maven-vm1:8081/nexus/content/groups/public/url /mirror profile idnexus/id repositories repository idcentral/id urlhttp://central/url releases enabledtrue/enabled updatePolicyalways/updatePolicy /releases snapshots enabledtrue/enabled updatePolicyalways/updatePolicy /snapshots /repository /repositories pluginRepositories pluginRepository idcentral/id urlhttp://central/url releases enabledtrue/enabled /releases snapshots enabledtrue/enabled /snapshots /pluginRepository /pluginRepositories /profile activeProfiles activeProfilenexus/activeProfile /activeProfiles In my pom.xml I changed the following in distributionManagement urlscp://maven-vm1/srv/maven/snapshots/url to urlhttp://maven-vm1:8081/nexus/content/repositories/snapshots/url Still I cannot get it to upload to Nexus: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project MyApp: Failed to deploy artifacts: Could not transfer artifact no.company:MyApp:jar:2.5.1-20141008.085615-1 from/to snapshots (http://maven-vm1:8081/nexus/content/repositories/snapshots): Failed to transfer file: http://maven-vm1:8081/nexus/content/repositories/snapshots/no/company/MyApp/2.5.1-SNAPSHOT/MyApp-2.5.1-20141008.085615-1.jar . Return code is: 401, ReasonPhrase: Unauthorized. - [Help 1] -- View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808056.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Running integration tests
Hi Robert, On 10/6/14 11:31 AM, Robert Mark Bram wrote: Hi All, A couple of questions about integration tests.. 1) Default vs non-default plugins I needed to include the maven-failsafe-plugin plugin to introduce integration tests into my project, but I didn't need to introduce the maven-surefire-plugin to my pom.xml for unit tests. Fair enough, but how do I know which plugins are included by default? This can be read here: http://maven.apache.org/ref/3.1.1/maven-core/default-bindings.html There you can see for which packaging type which plugins are bound to the particular life cycle phases... 2) Just run integration tests? I can see that unit tests are all classes with names like *Test.java and integration tests are all classes with names like IT.java. But mvn verify and mvn test seem to run all tests (unit and integrations). Is there a way to run just one or the other? mvn test should not run integration tests...if it will so you have configured it wrong and not used maven-failsafe-plugin and bound to the wrong life cycle...cause the phases: pre-integration-test, integration-test and post-integration-test ran after package phase... So they will only be reached if you do mvn verify If you like to run only integration tests you can do this via configuring maven-surefire-plugin with a parameter skip... mvn -Dskip.unit.tests=true verify which will skip the unit tests but run the integration tests... 3) Run integration tests after compile? The real reason for question 2 is that I wish to run integration tests only after I have deployed the new application to ensure the integration tests run on the server with the new content. Is there a way to do this? Based on the life cylce this is guaranteed... Thanks for any assistance! You're welcome... Kind regards Karl-Heinz Marbaise - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: maven deploy artifacts to Nexus repository
That was it. snapshotRepository idsnapshots/id urlhttp://maven-vm1:8081/nexus/content/repositories/snapshots/url /snapshotRepository repository idreleases/id urlhttp://maven-vm1:8081/nexus/content/repositories/releases/url /repository I had to create two servers with both these Id's, then it worked just fine. Maybe I missed it, but I couldn't find anywhere in the documentation that this id needed to match the id in the server. -- View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808061.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: maven deploy artifacts to Nexus repository
Trying to also use http with Nexus site deployment didn't work. [INFO] --- maven-site-plugin:3.4:deploy (default-deploy) @ MyApp --- http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session: Opened [INFO] Pushing /home/sverre/workspace/MyApp-R11/target/site [INFO] to http://maven-vm1:8081/nexus/content/sites/site/MyApp/./ Uploading: .//source-repository.html to http://maven-vm1:8081/nexus/content/sites/site/MyApp/ ##http://maven-vm1:8081/nexus/content/sites/site/MyApp/./source-repository.html - Status code: 404 http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session: Disconnecting http://maven-vm1:8081/nexus/content/sites/site/MyApp/ - Session: Disconnected [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 03:20 min [INFO] Finished at: 2014-10-08T13:03:21+01:00 [INFO] Final Memory: 90M/2309M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.4:deploy (default-deploy) on project MyApp: Error uploading site: File: http://maven-vm1:8081/nexus/content/sites/site/MyApp/./source-repository.html does not exist - [Help 1] [ERROR] I didn't have anything under Nexus sites before this. http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html http://books.sonatype.com/nexus-book/reference/_configuring_maven_for_site_deployment.html site iddeployment/id nameSites/name urldav:http://meta-vm1:8081/nexus/content/sites/site/${project.artifactId}/${project.version}/url /site Added the following build extension: extension groupIdorg.apache.maven.wagon/groupId artifactIdwagon-webdav-jackrabbit/artifactId version2.7/version /extension Anyhow: I'm not sure, but could this be a problem with Nexus and not Maven? -- View this message in context: http://maven.40175.n5.nabble.com/maven-deploy-artifacts-to-Nexus-repository-tp5751512p5808068.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: WAR contains SNAPSHOT JARs with timestamps
Why you can´t use timestamped (SNAPSHOT) jars? Anyway, maybe this can help you http://stackoverflow.com/questions/1243574/how-to-stop-maven-artifactory-from-keeping-snapshots-with-timestamps 2014-10-08 0:21 GMT-03:00 captainslow srinivas.nag...@gmail.com: I tried adding the following, but couldn't get it to work. Timestamp was appended to the SNAPSHOT jars. {code} plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.4/version configuration outputFileNameMapping@{artifactId}@-@{baseVersion}@.@{extension}@ /outputFileNameMapping /configuration /plugin {/code} -- View this message in context: http://maven.40175.n5.nabble.com/WAR-contains-SNAPSHOT-JARs-with-timestamps-tp5807695p5808036.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Why do running modules in parallel take longer to execute than running them in sequence?
Hi, I’m using Maven 3.2.3, Spring 3.2.11.RELEASE, JUnit 4.11, Java 6, and the Surefire/Failsafe 2.17 plugins. I’m trying to figure out why when running a couple of modules in parallel, it takes much longer than when I run them individually. I’m trying to figure out ways to speed up my build. I have this in my parent pom … modules modulecore/module … modulemodule-x/module modulemodule-y/module /modules When I run “mvn clean install -T 4”, modules “module-x” and “module-y” run in parallel. Both have a number of integration tests, all using @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ classpath:test-context.xml }) public class MyServiceIT { Below are my surefire/failsafe configurations … plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.17/version configuration reuseForkstrue/reuseForks argLine-Xmx2048m -XX:MaxPermSize=512M /argLine skipTests${skipAllTests}/skipTests /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.17/version configuration reuseForkstrue/reuseForks argLine-Xmx4096m -XX:MaxPermSize=512M /argLine skipTests${skipAllTests}/skipTests /configuration executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin When I run the tests in parallel, the modules take 11 minutes and 13 minutes, respectively, to run. However, running them concurrently (without the “-T” option), they execute in 6 minutes and 9 minutes, respectively. I’m confused about why they take so much longer to run when they both run at the same time and was hoping some folks could suggest some ways I can troubleshoot this further. -- View this message in context: http://maven.40175.n5.nabble.com/Why-do-running-modules-in-parallel-take-longer-to-execute-than-running-them-in-sequence-tp5808128.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why do running modules in parallel take longer to execute than running them in sequence?
Hi, have paid attention to forkCount ? How did you set it? How many core's do you have ? On 10/8/14 8:44 PM, laredotornado-3 wrote: Hi, I’m using Maven 3.2.3, Spring 3.2.11.RELEASE, JUnit 4.11, Java 6, and the Surefire/Failsafe 2.17 plugins. I’m trying to figure out why when running a couple of modules in parallel, it takes much longer than when I run them individually. I’m trying to figure out ways to speed up my build. I have this in my parent pom … modules modulecore/module … modulemodule-x/module modulemodule-y/module /modules When I run “mvn clean install -T 4”, modules “module-x” and “module-y” run in parallel. Both have a number of integration tests, all using @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ classpath:test-context.xml }) public class MyServiceIT { Below are my surefire/failsafe configurations … plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.17/version configuration reuseForkstrue/reuseForks argLine-Xmx2048m -XX:MaxPermSize=512M /argLine skipTests${skipAllTests}/skipTests /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.17/version configuration reuseForkstrue/reuseForks argLine-Xmx4096m -XX:MaxPermSize=512M /argLine skipTests${skipAllTests}/skipTests /configuration executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin When I run the tests in parallel, the modules take 11 minutes and 13 minutes, respectively, to run. However, running them concurrently (without the “-T” option), they execute in 6 minutes and 9 minutes, respectively. I’m confused about why they take so much longer to run when they both run at the same time and was hoping some folks could suggest some ways I can troubleshoot this further. Kind regards Karl-Heinz Marbaise - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why do running modules in parallel take longer to execute than running them in sequence?
Hi, laredotornado-3 wrote: Hi, I’m using Maven 3.2.3, Spring 3.2.11.RELEASE, JUnit 4.11, Java 6, and the Surefire/Failsafe 2.17 plugins. I’m trying to figure out why when running a couple of modules in parallel, it takes much longer than when I run them individually. I’m trying to figure out ways to speed up my build. I have this in my parent pom … modules modulecore/module … modulemodule-x/module modulemodule-y/module /modules When I run “mvn clean install -T 4”, modules “module-x” and “module-y” run in parallel. Both have a number of integration tests, all using @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ classpath:test-context.xml }) public class MyServiceIT { Below are my surefire/failsafe configurations … plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.17/version configuration reuseForkstrue/reuseForks argLine-Xmx2048m -XX:MaxPermSize=512M /argLine skipTests${skipAllTests}/skipTests /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-failsafe-plugin/artifactId version2.17/version configuration reuseForkstrue/reuseForks argLine-Xmx4096m -XX:MaxPermSize=512M /argLine skipTests${skipAllTests}/skipTests /configuration executions execution goals goalintegration-test/goal goalverify/goal /goals /execution /executions /plugin When I run the tests in parallel, the modules take 11 minutes and 13 minutes, respectively, to run. However, running them concurrently (without the “-T” option), they execute in 6 minutes and 9 minutes, respectively. I’m confused about why they take so much longer to run when they both run at the same time and was hoping some folks could suggest some ways I can troubleshoot this further. How much memory do you have? Your test processes take quite a lot and executing them in parallel might simply activate disk swapping. - Jörg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Why do running modules in parallel take longer to execute than running them in sequence?
Hi, Karl, to answer your question, I only have one processor on my MacBook Pro (10.9.5), which is a 2.2 GHz Intel Core i7. I haven't set forkCount in either my surefire or failsafe plugin (configs listed in question) because I was under the impression that the -T option took care of that. Jörg, My $MAVEN_OPTS var is set to -Xmx4096m, but I thought I read somewhere that in the case of surefire/failsafe, MAVEN_OPTS is ignored in favor of the configurations listed in the plugins, which are -Xmx2048m -XX:MaxPermSize=512M for surefire and -Xmx4096m -XX:MaxPermSize=512M for failsafe. Thanks, - Dave -- View this message in context: http://maven.40175.n5.nabble.com/Why-do-running-modules-in-parallel-take-longer-to-execute-than-running-them-in-sequence-tp5808128p5808146.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
How do I test client and server since they form circular dependencies?
I have a client and server in a multi-module. How do I test them ? I’d like to start the server in a test, then run the client against it. Then I’d like to run the client in a test, and have to test a server… maybe one idea is to build a meta-module like foo-client-server-test which as a dependency on foo-client and foo-server. then they could each test each other? Seems a bit of a hack but it should work .. -- Founder/CEO Spinn3r.com Location: *San Francisco, CA* blog: http://burtonator.wordpress.com … or check out my Google+ profile https://plus.google.com/102718274791889610666/posts http://spinn3r.com
Re: How do I test client and server since they form circular dependencies?
Am Wed, 8 Oct 2014 19:53:20 -0700 schrieb Kevin Burton bur...@spinn3r.com: maybe one idea is to build a meta-module like foo-client-server-test which as a dependency on foo-client and foo-server. then they could each test each other? Seems a bit of a hack but it should work .. Yes, have an integration test module in your reactor which depends on both. Thats not a hack, is a good way to do that. Gruss Bernd - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How do I test client and server since they form circular dependencies?
On 9 October 2014 13:49, Bernd Eckenfels e...@zusammenkunft.net wrote: Am Wed, 8 Oct 2014 19:53:20 -0700 schrieb Kevin Burton bur...@spinn3r.com: maybe one idea is to build a meta-module like foo-client-server-test which as a dependency on foo-client and foo-server. then they could each test each other? Seems a bit of a hack but it should work .. Yes, have an integration test module in your reactor which depends on both. Thats not a hack, is a good way to do that. A circular dependency is normally a sign that you haven't got your separations right. In order to run your test you need to use both the server and client, that sounds like a dependency to me! And so you need a new module to express that dependency in.