【问题标题】:Netbeans build failureNetbeans 构建失败
【发布时间】:2013-12-03 20:14:06
【问题描述】:

netbeans 新手,正在编写地址簿教程。我能够毫无问题地运行该程序,但是在构建时出现以下错误。我还没有找到任何可能的解决方案

Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy (deploy) on project address-book: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: Failed to create deployer with implementation class org.codehaus.cargo.container.glassfish.GlassFish4xInstalledLocalDeployer for the parameters (container [id = [glassfish4x]], deployer type [installed]). InvocationTargetException: The container configuration directory "c://glassfish4/glassfish/domains" does not exist. Please configure the container before attempting to perform any local deployment. Read more on: http://cargo.codehaus.org/Local+Configuration -> [Help 1]

【问题讨论】:

    标签: maven netbeans glassfish


    【解决方案1】:

    Maven 如何知道要部署到哪个服务器以及它位于何处?

    全部都在pom.xml 文件中。

    有时您必须追踪pom.xml 的父母才能找到它。

    在 Java EE 教程的情况下,当我构建项目 hello1 时,Maven 找不到我的 GlassFish 服务器的位置。

    我追踪pom.xml的父母找到 C:\mine\tools_installation\glassfish4\docs\javaee-tutorial\examples\pom.xml(51):
    <glassfish.home.prefix>c:/</glassfish.home.prefix>
    然后我把它改成 &lt;glassfish.home.prefix&gt;c:/mine/tools_installation&lt;/glassfish.home.prefix&gt;.

    【讨论】:

      【解决方案2】:

      容器配置目录“c://glassfish4/glassfish/domains”不存在。

      Maven / Cargo 查找 pom.xml 中定义的文件夹,但它在您的计算机上不存在。

      您需要更改的属性是,您需要将其设置为 GlassFish 安装目录。

      【讨论】:

      • 'C://...' 中的那些双 // 看起来有点怀疑我认为你可以只用一个,但只是猜测。 pom.xml 中到底有什么?
      【解决方案3】:

      所以它会自动从父 examples 文件夹 pom.xml 中获取,而不是从您打开的示例中获取。所以你应该从

      编辑pom.xml
      YOUR_GLASSFISH_HOME\docs\javaee-tutorial\examples
      

      它认为这是示例中的错误pom.xml

      【讨论】:

        【解决方案4】:

        我遇到了类似的错误,解决方法很简单你需要编辑pom.xml文件如下。替换第 38 行: ${glassfish.home.prefix}/glassfish4 到您的 GlassFish 家,我运行安装在 C:\ 驱动器中的 GlassFish 4.1.1。所以我的修改是: ${glassfish.home.prefix}glassfish-4.1.1.

        请注意删除 glassfish 之前的斜线。 c: 后的斜线在第 51 行就足够了。 重新构建它。应该没问题。

        【讨论】:

          【解决方案5】:

          我解决了这个错误,在 pom.xml 中添加了这些行:

          <profiles>
              <profile>
                  <id>windows</id>
                  <activation>
                      <os>
                          <family>windows</family>
                      </os>
                  </activation>
                  <properties>
                      <glassfish.home>C://Program Files//glassfish-4.1.1</glassfish.home>
                  </properties>
              </profile>
          </profiles>   
          

          希望对你有帮助

          【讨论】:

          • 您对用户示例的解决方案是拼凑而成,因为您没有修复父 pom.xml 文件。不要将这些行添加到子文件夹的pom.xml,而是尝试将glassfish.home 标记值替换为glassfish-4.1.1。对于本教程的示例,它通常位于类似 glassfish-4.1.1\docs\javaee-tutorial\examples 这样的目录中。
          【解决方案6】:

          我通常也将 glassfish 开发服务器安装在 c:/opt 下,因此 Java Platform, Enterprise Edition (Java EE) 8 教程中的 hello2 教程遇到了同样的问题。

          为了解决这个问题,我更改了 "tutorial-examples/pom.xml" 文件,它是所有教程 POM 文件的根父级。由于我使用的是 J2EE8 教程,因此预计 glassfish5 已安装,因此这反映在 properties 部分:

          <glassfish.home>${glassfish.home.prefix}/glassfish5</glassfish.home>
          

          我不确定您正在阅读哪个教程版本,但正如我所见,它需要安装 glassfish 4,因此您需要相应地编辑 POM 文件。

          另外(在 J2EE 8 教程中),为每个受支持的配置文件定义了 ${glassfish.home.prefix}。对于 windows 的 windows 配置文件,我不得不改变这一行:

          <glassfish.home.prefix>c:/</glassfish.home.prefix>
          

          到

          <glassfish.home.prefix>c:/opt</glassfish.home.prefix>
          

          所以完整的 Windows 配置文件将是:

          <profile>
                  <id>windows</id>
                  <activation>
                      <os>
                          <family>windows</family>
                      </os>
                  </activation>
                  <properties>
                      <glassfish.home.prefix>c:/opt</glassfish.home.prefix>
                      <glassfish.executables.suffix>.bat</glassfish.executables.suffix>
                  </properties>
          </profile>
          

          当然,您必须根据自己的设置编辑 POM 文件。

          【讨论】:

            猜你喜欢
            • 2018-04-06
            • 2019-06-15
            • 1970-01-01
            • 2019-05-30
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2015-01-22
            • 1970-01-01
            相关资源
            最近更新 更多