【问题标题】:weblogic.xml file is missing in WAR file ...Not able to generate WAR file (***with weblogic.xml file) for WebLogic server using Maven in Eclipse.WAR 文件中缺少 weblogic.xml 文件...无法在 Eclipse 中使用 Maven 为 WebLogic 服务器生成 WAR 文件(带有 weblogic.xml 文件)。
【发布时间】:2016-11-19 21:49:44
【问题描述】:

我试图寻找解决方案,但到目前为止没有答案...我有一个 Java 动态 Web 项目,并尝试构建一个 WAR 文件并将其部署在使用 Eclipse Luna 中的 Maven 的 WebLogic 应用程序服务器中。我无法在 Eclipse 中使用 Maven 工具生成带有 weblogic.xml 文件的 WAR 文件

这里是步骤...

项目 --> 右键单击​​ --> 以 Maven 构建方式运行 --> 全新安装 --> 使用 web.xml 文件生成 WAR 文件,但缺少 weblogic.xml。 我需要在 pom.xml 文件项目中提供任何配置,以便为 WebLogic 11 应用程序服务器生成 weblogic.xml 文件?只需要生成带有web.xml文件和Weblogic.xml文件的WAR文件,我需要通过控制台手动部署到WebLogic应用服务器中。

这是我的 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>
    <groupId>APL_LGS_DownoadService</groupId>
    <artifactId>APL_LGS_DownloadService</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>JBoss repository</id>
            <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>3.0.4.Final</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webXml>WebContent\WEB-INF\web.xml</webXml>
                    <webResources>
                        <resource>
                            <filtering>true</filtering>
                            <directory>src/main/resources</directory>
                            <includes>
                                <include>WEB-INF/weblogic.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

【问题讨论】:

  • Maven 使用约定优于配置。删除 标记后会发生什么?它可能只是为你捆绑它。
  • 您好,感谢您的评论。 pom.xml 文件中没有 标记,构建失败并出现错误.... 组装 WAR 时出错:需要 webxml 属性(如果在更新模式下执行,则需要预先存在的 WEB-INF/web.xml)-> [帮助 1所以,我只添加了 WebContent\WEB-INF\web.xml 并且现在构建成功,但仍然缺少 weblogic.xml ......不知道是什么我在 pom.xml 文件中丢失了!它花了我 3 天的时间仍然无法弄清楚。
  • 我认为您可以删除 标记。确认 weblogic.xml 确实在 WEB-INF 文件夹下。然后尝试 1. 右键单击​​项目 -> Maven -> 更新项目 -> 确定 2. 运行方式 -> Maven clean 3. 运行方式 -> Maven 安装。
  • maven.apache.org/POM/4.0.0" xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:schemaLocation="maven.apache.org/POM/4.0.0 maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0APL_LGS_DownoadService APL_LGS_DownloadServicewar0.0.1-SNAPSHOTUTF-8 project.build.sourceEncoding>
  • JBoss 存储库repository.jboss.org/nexus/content/groups/public-jboss/</url> org.jboss .resteasyresteasy-jaxrs3.0.4.Final

标签: xml maven


【解决方案1】:

我认为您可以删除该标签。 还要确认 weblogic.xml 确实在 WEB-INF 文件夹下。 然后尝试 1.右键项目->Maven->更新项目->确定 2.右键项目->运行方式->Maven clean 3.右键项目->运行方式->Maven安装

如果失败,我会尝试创建一个新的 Maven 项目来构建/测试。 文件 -> 新建 -> 其他 -> Maven 项目 使用 org.apache.maven.archetypes : maven-archetype-webapp : 1.0

将weblogic.xml放到WEB-INF文件夹下,进行maven clean install。

如果可行,您可以比较“有效 POM”选项卡,看看新项目和损坏的项目有什么不同。

【讨论】:

  • 嗨,我尝试在 Eclipse 中创建一个新的 Maven 项目 --> 文件 --> 新建 --> Maven 项目 --> 下一步 --> maven-archetype-webapp : 1.0 --> 组ID (com.sample2) --> 工件 ID (sample2) --> 完成。使用以下结构创建的 Maven 项目。 1. src --> main --> 资源 2. Java 资源 --> src/main/resources 我可以知道在哪里创建我的 java 类吗?现在对这种结构感到困惑。 Maven --> clean--> 安装创建的没有类文件的 WAR 文件。请帮助我明智地创建 Java 类文件 pom.xml 和 web.xml 结构的步骤。我坚持了一周。
  • Java 类进入 src/main/java。参考这个maven.apache.org/guides/introduction/…和这个mkyong.com/maven/…
  • 谢谢,我找到了解决方案,它可能对其他人有帮助。问题出在 web.xml 文件上。我将其更改为 w3.org/2001/XMLSchema-instance" xmlns="java.sun.com/xml/ns/javaee" xsi:schemaLocation="java.sun.com/xml/ns/javaee java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> 而不是 3.0。它运行良好,部署成功。
猜你喜欢
  • 2013-09-30
  • 1970-01-01
  • 2018-10-14
  • 2017-11-02
  • 2013-05-13
  • 2011-06-02
  • 2012-12-17
  • 1970-01-01
  • 2012-02-07
相关资源
最近更新 更多