【问题标题】:Extjs 6 Sencha Cmd and Spring BootExtjs 6 Sencha Cmd 和 Spring Boot
【发布时间】:2016-05-16 08:22:42
【问题描述】:

我正在尝试使用 Extjs 6 和 Spring 引导堆栈实现简单的 Web 应用程序。

使用 sencha cmd 我们可以创建独立的 Extjs 应用程序。但我需要将此应用程序作为我的 Spring Boot Web 应用程序的一部分。它应该通过 spring boot 添加到 WAR 文件构建中。

我的spring web应用结构应该是怎样的?

如何使用 sencha cmd 和 spring boot 一起构建?

对此进行了很多搜索,但找不到合适的答案。

【问题讨论】:

  • 您阅读过有关spring boot + angularjs 的文档吗?我很确定类似的设置适用于包括 Extjs 在内的任何水疗中心。
  • 它使用的是 wro4j,extjs 6 尚不完全支持。我的问题是如何将使用 sencha cmd 创建的应用程序集成到 spring boot web 应用程序中。或者如何使用 sencha cmd 编译/打包具有 extjs ui 的 Spring Boot Web 应用程序。
  • 你用的是maven还是gradle?
  • 我正在使用 Maven。我找到了一种使用 maven build 进行设置的解决方案。需要在 maven build 中使用 exec 插件,并将 sencha build 输出复制到 webapp。
  • 我在这里问同样的问题:stackoverflow.com/questions/43634461/stack-extjs-6-spring-boot你找到解决方案了吗?

标签: extjs spring-boot sencha-cmd


【解决方案1】:

使用 Spring Boot,我们现在通常将事情作为 jar 并将它们打包在 jar 中。嵌入式 Web 服务器可以直接提供 jar 中的内容。您可以将 WAR 文件与 Jboss 或其他应用程序服务器一起使用。

在您的运行时模块中,只需使用典型的 @SpringBootApplication 并拉取

我在我的 maven pom.xml 中使用它: 罐子

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.5.0</version>
    <executions>
      <execution>
        <id>sencha-compile</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <!-- Set path to your Sencha Cmd executable-->
          <!--<executable>../Sencha/Cmd/6.xxx/sencha</executable>-->
          <executable>sencha</executable>
          <workingDirectory>${basedir}/src/main/extjs</workingDirectory>
          <arguments>
            <argument>app</argument>
            <argument>build</argument>
            <argument>testing</argument>
          </arguments>
        </configuration>
      </execution>
    </executions>
  </plugin>

  <plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.0.1</version>
    <executions>
      <execution>
        <id>copy-resources</id>
        <!-- here the phase you need -->
        <!--<phase>package</phase>-->
        <phase>compile</phase>
        <goals>
          <goal>copy-resources</goal>
        </goals>
        <configuration>
          <outputDirectory>${basedir}/target/classes/public</outputDirectory>
          <resources>
            <resource>
              <!-- for production -->
              <directory>src/main/extjs/build/testing/yourpath</directory>

              <filtering>false</filtering>
            </resource>
          </resources>
        </configuration>
      </execution>
    </executions>
  </plugin>

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.5</version>
    <configuration>
      <filesets>
        <fileset>
          <directory>${project.basedir}/src/main/extjs/build</directory>
          <includes>
            <include>**/*</include>
          </includes>
          <followSymlinks>false</followSymlinks>
        </fileset>
      </filesets>
    </configuration>
  </plugin>

【讨论】:

  • 我玩弄了一些更有效的构建策略。但我知道这对每个人都有效。
猜你喜欢
  • 2017-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多