This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven not running Spring Integration Samples Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven not running Spring Integration Samples" Watch "Maven not running Spring Integration Samples" New topic
Author

Maven not running Spring Integration Samples

Kaspar Christenson
Greenhorn

Joined: Feb 26, 2009
Posts: 21

I'm trying to run the FeedInboundChannelAdapterSample from the SpringSource-spring-integration-samples distribution.
When I run 'mvn test' it says There are no tests to run.
There's a method with the @Test annotation so why isn't mvn running this test?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Well, that isn't a Spring question, it is a Maven question. Maybe the maven pom file isn't running tests, maybe it was run with your settings file having running tests not run them. Maybe the Test class isn't in the test directory that Maven is looking at.

Have you tried just running the test in your IDE? That is how I run all my tests.

I am going to move this to the Maven forum.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5811
    
    7

How are you tests defined? By default, the Surefire plugin runs tests that it finds in the src/test/java directory, and it only runs tests whose classnames begin or end with "Test". Thus, tests in this class would be run:

src/test/java/my/package/SomeTest.java

but tests in this class would not be run:

src/test/java/my/package/SomeTests.java

Check the "includes" parameters here: http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html


JBoss In Action
Kaspar Christenson
Greenhorn

Joined: Feb 26, 2009
Posts: 21

I didn't write the test or the code. I'm just trying to run the a sample program provided in the SpringSource distribution of Spring Integration Samples.
I was hoping the someone else on the Spring Forum might know if these samples run as is or if they need tweaking.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Kaspar

As indicated by Peter, where does the test class reside and what is it called?
Kaspar Christenson
Greenhorn

Joined: Feb 26, 2009
Posts: 21

The accursed class is in src/test/java/somepackage/FeedInboundChannelAdapterSample.java
It doesn't have Test or Tests in the name.

So I can either change the name of the class or configure the plugin in the pom?
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<includes>
<include>**/*Sample.java</include>
</includes>
</configuration>
</plugin>
</plugins>

I don't know squat about maven. Thanks for the help.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 391
1. Keep the source code downloaded as is.
2. Just rename public class FeedInboundChannelAdapterSample to public class FeedInboundChannelAdapterSampleTest
3. mvn test.

(P:S: I just happened and wanted to learn SI. and maven as well :-D)

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5811
    
    7

@Caspar, yes either of your solutions would work. But as H indicated, renaming the class is probably the easiest.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven not running Spring Integration Samples
 
Similar Threads
Selenium Maven combo - too fast to find components on UI
how do i send a email test report from maven
Problem with the "mvn test" command missing EJB client jar artifact
Is anyone using WLI on XP
autowiring remote beans