gpt4 book ai didi

java - 在更新 Maven 项目时,它会在 .classpath 文件中删除 eclipse 中的属性名称 ="org.eclipse.jst.component.dependency"

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:56:32 25 4
gpt4 key购买 nike

项目描述:

  • 动态网络项目。
  • Maven for dependencies 我使用 eclipse 默认编译编译项目。我没有编译项目 maven 。
  • java 6(在 pom.xml 中提到源和目标为 java6,但当前在 eclipse 中安装的版本是 java 7)。
  • 这是一个网络应用程序。我在项目中使用了jsf、hibernate、spring、spring-security。

以下几行来 self 在 eclipse 中为该项目创建的“.classpath”文件。

<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>

如果我更新 Maven,请右键单击项目,Maven -> 更新项目。我在类路径中发现了变化。

 <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>

上面的行不见了。如果没有这个,我的项目就不会在 eclipse 的 tomcat 中运行。我正在尝试通过使用键盘快捷键“shift-alt-x R”选择“在服务器上运行”选项来运行该项目。

早些时候,同一项目正在运行。从新安装的 SVN 为该项目更新项目后,我面临这个问题。帮助我从哪里开始寻找问题。如果需要,请询问更多信息,以便您可以帮助我解决此问题。

这里是堆栈跟踪的一部分,

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MyProject]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

最佳答案

其实这是一个java版本相关的问题。由于此项目依赖于在使用 Java 6 的服务器中运行的 Java 项目,我们已将该项目从 Java 7 降级到 Java 6。

我已经更改了运行时、构建路径和指向 Java 6 的 pom.xml。但是,忘记更改 web.xml header 端点。

因此,在更新项目时,eclipse突然发现这是一个web项目。

来自(java 7)

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID"
version="3.1">

到(java 6)

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID"
version="3.0">

此更改后,在“maven-> update project”上我得到了正确的项目设置。

关于java - 在更新 Maven 项目时,它会在 .classpath 文件中删除 eclipse 中的属性名称 ="org.eclipse.jst.component.dependency",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33958374/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com