Eclipse 在 wtpwebapps 中生成我的类 3 次
我有一个 PrettyFaces 框架的问题,当使用 eclipse 在服务器(tomcat 6)上运行应用程序时,多次找到一个类
,我发现 eclipse 在 wtpwebapps 中多次生成该类:
\WEB-INF\classes\com\myapp\sample\beans\myclass.class
WEB-INF\classes\target\classes\com\myapp\sample\beans\myclass.class
\WEB-INF\classes\target\app-name\WEB-INF\classes\com\myapp\sample\beans\myclass.class
更新:
我正在使用 m2eclipse 插件,并使用 maven 作为我的构建工具,也许它们的配置有问题,或者需要配置一些东西。
更新2:
这是pom文件构建,也许我有问题:有
<build>
<finalName>appName</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
什么想法如何解决这个问题吗?
i had an issue with PrettyFaces framework that a class is found more than once when using eclipse to run application on server (tomcat 6)
what i found is that eclipse generates the class more than once in wtpwebapps:
\WEB-INF\classes\com\myapp\sample\beans\myclass.class
WEB-INF\classes\target\classes\com\myapp\sample\beans\myclass.class
\WEB-INF\classes\target\app-name\WEB-INF\classes\com\myapp\sample\beans\myclass.class
UPDATE:
i am using m2eclipse plugin, and using maven as my build tool, maybe there's a configuration wrong with them, or something needed to be configured.
UPDATE2:
here's the pom file build, maybe i have something wrong with it:
<build>
<finalName>appName</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
any ideas how to fix this issue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我安装了“m2e wtp”连接器了吗? Maven->发现->打开目录(在 Indigo 中)搜索“wtp”。
考虑使用:
那么可能不需要按照您的方式设置UTF-8。但也许此时您有另一种编码,但如果有 *.java 一种编码和另一种编码的资源,那就很奇怪了。最好使整个项目相同。
您能否确认您是否正在构建 WAR 并且这就是您在 WAR 中看到的内容?或者如果正在使用 Eclipse 的启动 Tomcat 功能,这就是您在项目中看到的内容。
另外确认你已经使用了Stop Tomcat、Clean,手动检查目录是否已经清除掉了(也许做一下工作区刷新,以及另一个Servers -> Clean,手动删除Tomcat区域中的文件)。然后执行完整发布(到 tomcat),然后启动/调试 tomcat 来启动。
我猜想如果您现在拥有的配置如上所示(并且假设没有父 pom.xml 严重影响构建),您看到的文件是在弄乱 Maven 配置后未清理 wtpwebapps 区域的结果。
有多个地方需要检查是否清洁:
I have you installed the "m2e wtp" connector ? Maven -> Discovery -> Open Catalog (in Indigo) search "wtp".
Consider using:
then there may not be any need for setting UTF-8 in the way you do. But maybe you have another encoding at this point, but then it would be strange to have *.java one encoding and resources in another. Best to make the whole project same.
Can you confirm if you are building a WAR and this is what you see in the WAR ? or if are using the launch Tomcat ability from Eclipse and this is what you see in the project.
Also confirm that you have used the Stop Tomcat, Clean, manually check the directory have cleared out (maybe do a workspace refresh, and another Servers -> Clean, manually delete files in Tomcat area). Then do a Full Publish (to tomcat) and then Start/Debug tomcat to launch.
I would guess if the configuration you now have is as above (and presuming no parent pom.xml is affecting the build do badly) that the files you see are a result of not cleaning the wtpwebapps area after messing around with the maven config.
There are multiple places to check gets cleaned: