本文介绍了如何防止eclipse在Tomcat上部署测试类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Maven项目,其中包含典型的文件夹 src / main / java src / test / java 而我正在使用Eclipse 3.7和m2e 1.0.Maven Integration for WTP 1.4.0。 Eclipse在开发过程中在服务器(Tomcat或Glassfish)上部署应用程序时使用,但它也从 src / test / java 文件夹中部署测试类。



我不想部署测试类,所以我如何从eclipse-tomcat部署排除该目录?

解决方案

它可以在Eclipse中配置如何处理和部署不同的文件夹,不知何故Eclipse插件M2Eclipse应该配置Eclipse,它接缝,配置有时完成,有时不完成。



所以必须检查这两个设置:




  • 项目属性\Java Build Path(Tab)来源:< PROJECT> / src / test / java 以及< PROJECT> / src / test /资源必须是< PROJECT> / target / test-classes


  • Project Properties\Deployment Assembly:< PROJECT& / src / test / java < PROJECT> / target / test-classes



I have a Maven project, containing the typical folders src/main/java and src/test/java and I am using Eclipse 3.7 with m2e 1.0.and Maven Integration for WTP 1.4.0 . Eclipse is used during development to deploy the application on an server (Tomcat or Glassfish), but it deploys the test classes from src/test/java folder too.

I do not want the test classes deployed, so how can I "exclude" that directory from eclipse-tomcat deployment?

解决方案

It is configurable in Eclipse how to handle and deploy the different folders, somehow the Eclipse plugin M2Eclipse should configure Eclipse right, it seams that the configuration sometimes is done and sometimes not.

So one has to check this two settings:

  • Project Properties\Java Build Path(Tab)Source : Outputfolder for <PROJECT>/src/test/java as well as <PROJECT>/src/test/resources must be <PROJECT>/target/test-classes

  • Project Properties\Deployment Assembly : There must be NO entry for <PROJECT>/src/test/java or <PROJECT>/target/test-classes

这篇关于如何防止eclipse在Tomcat上部署测试类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 10:35