m2eclipse 和/或 wtp 未正确打包依赖项?

发布于 2024-12-27 23:48:50 字数 4276 浏览 0 评论 0原文

Eclipse Indigo SR 1、wtp 3.3.0、m2eclipse 1.0.100。

当将项目发布到 WTP 时,我遇到了依赖项之一的奇怪行为;它不是将 jar 放在 WEB-INF/lib 文件夹中,而是创建一个以预期 jar 命名的文件夹,然后将该项目中的源代码树(显然)放在该文件夹下。我在依赖项的 pom.xml 或该项目的 pom.xml 中看不到任何可能导致此问题的内容。

其他依赖项以 jar 的形式被很好地引入。

我的测试项目的 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>dwhwtptest</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>dwhwtptest Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.onebusaway</groupId>
      <artifactId>onebusaway-nyc-transit-data</artifactId>
      <version>2.0.3-SNAPSHOT</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>dwhwtptest</finalName>
  </build>
</project>

以下是最终在 workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps 发布的内容:

$ find  dwhwtptest/
dwhwtptest/
dwhwtptest//index.jsp
dwhwtptest//META-INF
dwhwtptest//META-INF/MANIFEST.MF
dwhwtptest//META-INF/maven
dwhwtptest//META-INF/maven/test
dwhwtptest//META-INF/maven/test/dwhwtptest
dwhwtptest//META-INF/maven/test/dwhwtptest/pom.properties
dwhwtptest//META-INF/maven/test/dwhwtptest/pom.xml
dwhwtptest//WEB-INF
dwhwtptest//WEB-INF/lib
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/META-INF
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/META-INF/MANIFEST.MF
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model/NycQueuedInferredLocationBean.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model/NycVehicleManagementStatusBean.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services/ConfigurationService.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services/VehicleTrackingManagementService.java
dwhwtptest//WEB-INF/web.xml

这是依赖项 onebusaway-nyc-transit-data 模块的 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>onebusaway-nyc</artifactId>
        <groupId>org.onebusaway</groupId>
        <version>2.0.3-SNAPSHOT</version>
    </parent>
    <groupId>org.onebusaway</groupId>
    <artifactId>onebusaway-nyc-transit-data</artifactId>
    <packaging>jar</packaging>

    <name>onebusaway-nyc-transit-data</name>
    <description>Common interfaces and classes for exchanging transit data between UI front-end and transit back-end data sources.</description>

    <build>
        <finalName>onebusaway-nyc-transit-data</finalName>
    </build>
</project>

有建议吗?我还可以调查其他什么事情来弄清楚这里发生了什么吗?

Eclipse Indigo SR 1, wtp 3.3.0, m2eclipse 1.0.100.

When publishing a project to WTP, I'm getting strange behavior with one of the dependencies; instead of putting the jar in the WEB-INF/lib folder, it's creating a folder named for the expected jar, and then putting the source tree (apparently) from that project under that folder. I can't see anything in the dependency's pom.xml or this project's pom.xml that could be causing this.

Other dependencies are being brought over just fine, as jars.

My test project's pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>dwhwtptest</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>dwhwtptest Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.onebusaway</groupId>
      <artifactId>onebusaway-nyc-transit-data</artifactId>
      <version>2.0.3-SNAPSHOT</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>dwhwtptest</finalName>
  </build>
</project>

Here's what ends up being published at workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps:

$ find  dwhwtptest/
dwhwtptest/
dwhwtptest//index.jsp
dwhwtptest//META-INF
dwhwtptest//META-INF/MANIFEST.MF
dwhwtptest//META-INF/maven
dwhwtptest//META-INF/maven/test
dwhwtptest//META-INF/maven/test/dwhwtptest
dwhwtptest//META-INF/maven/test/dwhwtptest/pom.properties
dwhwtptest//META-INF/maven/test/dwhwtptest/pom.xml
dwhwtptest//WEB-INF
dwhwtptest//WEB-INF/lib
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/META-INF
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/META-INF/MANIFEST.MF
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model/NycQueuedInferredLocationBean.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model/NycVehicleManagementStatusBean.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services/ConfigurationService.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services/VehicleTrackingManagementService.java
dwhwtptest//WEB-INF/web.xml

And here's the pom.xml for the dependency, the onebusaway-nyc-transit-data module:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>onebusaway-nyc</artifactId>
        <groupId>org.onebusaway</groupId>
        <version>2.0.3-SNAPSHOT</version>
    </parent>
    <groupId>org.onebusaway</groupId>
    <artifactId>onebusaway-nyc-transit-data</artifactId>
    <packaging>jar</packaging>

    <name>onebusaway-nyc-transit-data</name>
    <description>Common interfaces and classes for exchanging transit data between UI front-end and transit back-end data sources.</description>

    <build>
        <finalName>onebusaway-nyc-transit-data</finalName>
    </build>
</project>

Suggestions? Anything else I can investigate to try to figure out what's going on here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

岛徒 2025-01-03 23:48:50

我的一位同事为我提供了一种解决该问题的方法,但需要很少的手动步骤。

  • 从 eclipse 中删除项目

  • 使用终端转到 maven 根文件夹,并使用此命令杀死所有 eclipse 内容(您必须执行此操作两次):

    $>寻找 。 -iname ".settings" -exec rm -rf '{}' \; ;寻找 。 -iname ".project" -exec rm -rf '{}' \; ;寻找 。 -iname ".classpath" -exec rm -rf '{}'

  • 在你的 Maven 根目录上,执行以下命令:

    $> mvn -Dwtpversion=2.0 eclipse:eclipse

  • 将您的项目导入回 eclipse:现在一切都将正常工作,并且 eclipse 将发布包含代码的 jar :)

HTH,Bruno(归功于 Theodore!)

A colleague of mine provided me an approach that fixed the issue, but it requires few manual steps.

  • remove the project from your eclipse

  • go to your maven root folder with a terminal and kill all the eclipse stuff using this command (you will have to do this twice):

    $> find . -iname ".settings" -exec rm -rf '{}' \; ; find . -iname ".project" -exec rm -rf '{}' \; ; find . -iname ".classpath" -exec rm -rf '{}'

  • on your maven root, execute this command:

    $> mvn -Dwtpversion=2.0 eclipse:eclipse

  • import your project back in eclipse: everything will now work and eclipse will be publishing jars containing code :)

HTH, Bruno (credits to Theodore!)

凉城已无爱 2025-01-03 23:48:50

我建议除了当前安装的 m2e 插件(不包含对基于 WTP 的项目的支持)之外,尝试使用 m2e-wtp 插件。该插件可通过嵌入式 Marketplace 客户端在 Eclipse Marketplace 中或在 Web 上使用(http:// /marketplace.eclipse.org/content/maven-integration-eclipse-wtp)。它提供了 Maven 与 WTP 更紧密的集成,并且应该改善 Maven 与 WTP 的整体体验。

I suggest trying out the m2e-wtp plugin in addition to your currently installed m2e plugin (which doesn't contain support for WTP based projects) This plugin is available in the Eclipse Marketplace via the embedded Marketplace client or on the web (http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp). It provides a tighter Maven integration with WTP and should improve the overall Maven with WTP experience.

命比纸薄 2025-01-03 23:48:50

如果仍然不起作用,请删除发布文件夹。它看起来像这样:

<Path To Your IDE>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0

首先确保从 IDE 中删除 Tomcat 或您正在使用的任何其他服务器下的项目。然后关闭ID,否则无法删除该文件夹。

完成此操作后,您可以运行 maven clean/build/install 命令并部署项目。

如果这不起作用,则此问题与 IDE 或应用程序服务器无关。

If things still don't work go delete the publish folder. It will look something like:

<Path To Your IDE>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0

First make sure you REMOVE the project under Tomcat or whatever other server you are using from withing the IDE. Then close the ID or you cannot delete the folder.

Once you do this, you can run your maven clean/build/install command and deploy your project.

If this does not work, this problem isn't related to the IDE or the Application Server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文