2

I'm using IBM Integration Designer 7.5, which is a version of Eclipse 3.6 with some added features. I'm building a dynamic web project targeting Tomcat. The web project has a dependency on another project, a utility module.

I've configured the web project to include code from the utility module per this question and it works well. A WAR built from the web project includes a jar containing the class files from the utility module.

The problem is that the utility module includes some junit testcase classes, and they're being included in the jar that goes into the WAR. I'm looking for a way to leave out the junit classes.

In the utility module, the "real" code is in a folder called "src" and the test cases are in a second source folder called "test". I've gone to the Build path->Order and Export tab of the utility project, and it lists both "src" and "test" as exports. It's not possible to uncheck the box for the "test" entry. The eclipse documentation says that source folder are always exported from a project.

Is there a realistic way to fine-tune this setup so that the test cases aren't packaged into the web project?

Community
  • 1
  • 1
Kenster
  • 23,465
  • 21
  • 80
  • 106
  • 2
    Why not put the tests into a different project? – nitind Oct 30 '12 at 17:30
  • I guess that'd work, but it seems painful. Is this a typical way to organize projects? Eclipse doesn't seem to make that easy to do. E.g. right-click on a java class and pick New->Junit test case, the dialog that opens doesn't let you place the test case in a different project. – Kenster Oct 30 '12 at 18:05
  • Actually, yes it does let you put the test case in a different project. Once the new test case dialog is open, edit the source folder to change the project. – Kenster Jun 05 '13 at 13:49

1 Answers1

1

Do you have the source for the utility modue? What are you using as a build tool? If the answer to the first question is yes and the answer to the second question is not Maven, then use Maven. By default it excludes anything in the src/test directory from the build artifact. You will need to either rearrange your project directories to be the Maven default, or do some configuration of your POM file so that Maven knows which is the test directory.

sdoca
  • 7,832
  • 23
  • 70
  • 127