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

标签 java maven-2 ant extjs

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

我有 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>

我想知道执行此操作的“行家”方法是什么?有没有一种方法可以纯粹在 maven 中完成(查看了 maven:exec 插件,但有点令人困惑),或者我是否必须从 maven 调用 ant 才能实现此目的?

谢谢

最佳答案

exec-maven-plugin是正确的答案(尽管你想要 java 目标)。您需要将其绑定(bind)到生命周期阶段。看usage page举个例子。在你的情况下,你需要这样的东西:

<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>

如果您是 JSBuilder2 的大用户,值得询问 Cencha 是否可以将其发布到 Maven 中央存储库。将他们指向OSS Repository Hosting .

关于java - 在 Maven2 Web 应用程序中使用 JSBuilder2.jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3372130/

相关文章:

java - Spring MVC + Jackson-JsonView

java - 在 context.getBundle(0).adapt(FrameworkWiring.class).getDependencyClosure(bundles) 上使用 Maven 编译包时出错

maven-2 - Maven 程序集插件未设置 MainClass list 设置

java - 使用属性打开/关闭 Proguard

java - Jenkins 使用了错误的 Java 版本

java - 使用应用程序插件持续构建和运行Gradle应用程序

java - Spring框架请求范围和单例 Autowiring

java - 红黑树需要两次遍历

maven-2 - 如何让 mvn checkstyle 检查我的所有 javadoc 注释内容是否都以大写字母开头?

spring - 使用 ant 目标进行 junit 测试和非 junit 测试