Extjs 6与Sencha Cmd和Spring Boot相关联

3

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

使用Sencha Cmd,我们可以创建独立的Extjs应用程序。但是我需要将此应用程序作为Spring Boot Web应用程序的一部分。它应该被添加到由Spring Boot构建的WAR文件中。

我的Spring Web应用程序结构应该如何?

如何同时使用sencha cmd和spring boot进行构建?

在这方面进行了大量搜索,但未找到合适的答案。


你有没有阅读关于 spring boot + angularjs 的文档?我相信类似的设置也适用于任何单页应用程序,包括 Extjs。 - miensol
1
它正在使用wro4j,这还不完全支持extjs 6。我的问题是如何将使用sencha cmd创建的应用程序集成到spring boot web应用程序中。或者如何使用sencha cmd编译/打包具有extjs ui的spring boot web应用程序。 - Chaitu
你是在使用Maven还是Gradle? - Hernan Payrumani
1
我正在使用Maven。我找到了一种使用Maven构建的设置解决方案。需要在Maven构建中使用exec插件,并将Sencha构建输出复制到webapp中。 - Chaitu
我在这里问了相同的问题: http://stackoverflow.com/questions/43634461/stack-extjs-6-spring-boot 你找到解决方案了吗? - mik3fly-4steri5k
1个回答

0

使用Spring Boot时,我们通常将事物做成jar并将它们打包到jar中。嵌入式Web服务器可以直接从jar中提供内容。您可以在Jboss或其他应用服务器上使用WAR文件。

在运行时模块中,只需使用典型的@SpringBootApplication和pull即可

我在我的maven pom.xml中使用这个: jar

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

我已经尝试了一些更有效的构建策略,但是我知道这个策略对每个人都有效。 - Mike Samaras

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接