Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Maven2 Web应用程序中使用JSBuilder2.jar_Java_Maven 2_Ant_Extjs - Fatal编程技术网

Java 在Maven2 Web应用程序中使用JSBuilder2.jar

Java 在Maven2 Web应用程序中使用JSBuilder2.jar,java,maven-2,ant,extjs,Java,Maven 2,Ant,Extjs,我已经开始使用Maven2,我正在尝试将我的一个项目从ant移植到maven。我已经成功地构建了ear文件,使用了jaxb和其他bits,但还有一件事我不知道如何处理 我有WAR模块,带有ExtJS代码,我正在使用JSBuilder创建和打包代码。这是作为ant任务完成的,如下所示: <target name="-pre-compile" description="Building Frontend Libraries"> <java jar="web/lib/dev/

我已经开始使用Maven2,我正在尝试将我的一个项目从ant移植到maven。我已经成功地构建了ear文件,使用了jaxb和其他bits,但还有一件事我不知道如何处理

我有WAR模块,带有ExtJS代码,我正在使用JSBuilder创建和打包代码。这是作为ant任务完成的,如下所示:

<target name="-pre-compile" description="Building Frontend Libraries">
    <java jar="web/lib/dev/JSBuilder2.jar" failonerror="true" fork="true" >
        <arg line="--projectFile web/lib/dev/frontend.jsb2 --homeDir web/lib"/>
    </java>
</target>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1</version>
  <executions>
    <execution>
      <id>jsbuilder</id>
      <goals>
        <goal>java</goal>
      </goals>
      <phase>compile</phase>
      <configuration>
        <mainClass><!-- fill in from jar's META-INF/MANIFEST.MF --></mainClass>
        <argument>--projectFile</argument>
        <argument>web/lib/dev/frontend.jsb2</argument>
        <argument>--homedir</argument>
        <argument>web/lib</argument>
      </configuration>
    </execution>
  </executions>
  <configuration>
    <includeProjectDependencies>false</includeProjectDependencies>
    <includePluginDependencies>true</includePluginDependencies>
  </configuration>
  <dependencies>
    <!-- a bit nasty, would be better if jsbuilder2 available in a maven repo. -->
    <dependency>
      <groupId>com.extjs</groupId>
      <artifactId>jsbuilder2</artifactId>
      <version>2.0.0</version>
      <scope>system</scope>
      <systemPath>web/lib/dev/JSBuilder2.jar</systemPath>
    </dependency>
  </dependencies>
</plugin>

我想知道“maven”是怎么做的?是否有一种方法可以完全在maven中实现(查看了maven:exec插件,但有点混乱),或者我必须从maven调用ant才能实现这一点

谢谢

这是正确的答案(尽管您想要java目标)。您需要将其绑定到生命周期阶段。请看下面的示例。在你的情况下,你需要这样的东西:

<target name="-pre-compile" description="Building Frontend Libraries">
    <java jar="web/lib/dev/JSBuilder2.jar" failonerror="true" fork="true" >
        <arg line="--projectFile web/lib/dev/frontend.jsb2 --homeDir web/lib"/>
    </java>
</target>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1</version>
  <executions>
    <execution>
      <id>jsbuilder</id>
      <goals>
        <goal>java</goal>
      </goals>
      <phase>compile</phase>
      <configuration>
        <mainClass><!-- fill in from jar's META-INF/MANIFEST.MF --></mainClass>
        <argument>--projectFile</argument>
        <argument>web/lib/dev/frontend.jsb2</argument>
        <argument>--homedir</argument>
        <argument>web/lib</argument>
      </configuration>
    </execution>
  </executions>
  <configuration>
    <includeProjectDependencies>false</includeProjectDependencies>
    <includePluginDependencies>true</includePluginDependencies>
  </configuration>
  <dependencies>
    <!-- a bit nasty, would be better if jsbuilder2 available in a maven repo. -->
    <dependency>
      <groupId>com.extjs</groupId>
      <artifactId>jsbuilder2</artifactId>
      <version>2.0.0</version>
      <scope>system</scope>
      <systemPath>web/lib/dev/JSBuilder2.jar</systemPath>
    </dependency>
  </dependencies>
</plugin>

org.codehaus.mojo

.

你好,多米尼克,谢谢你的重播。我已经调整了您的示例,并且能够从maven调用JSBuilder,但是我现在遇到了一个小问题。脚本中描述的参数似乎对jsbuilder不可见。调用返回帮助打印输出,这表明没有传递任何必需的参数。我确实看过你提到的例子,看看它们,它们似乎应该没问题,所以我有点困惑。我想我会尝试使用不同版本的maven exec插件,但结果是一样的。我想知道问题出在哪里。多做些研究,解开谜团吧!:)我不得不将命令行参数作为一个字符串传递。非常感谢你的帮助!