2016-05-16 47 views
3

我想实现简单的Web应用程序与Extjs 6和Spring启动堆栈。Extjs 6 Sencha命令和弹簧启动

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

我的春天的web应用程序结构应该如何?

如何使用sencha cmd和弹簧套一起构建?

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

+0

你看了关于[春天开机+ angularjs]的文档(https://spring.io/blog/2015/01/12/spring-and-angular-js-a-secure-single-page-application)?我很确定,类似的设置可以与包括Extjs在内的任何Spa一起使用。 – miensol

+1

它使用的是wro4j,它尚未完全支持extjs 6.我的问题是如何将使用sencha cmd创建的应用程序集成到spring boot web应用程序中。或者如何使用sencha cmd编译/打包extjs ui的spring boot web应用程序。 – Chaitu

+0

你使用maven还是gradle? –

回答

0

随着Spring Boot的推出,我们现在通常将瓶子做成瓶子并将它们包装在瓶子中。嵌入式Web服务器可以直接从jar中提供内容。您将在Jboss或其他应用程序服务器上使用WAR文件。

在运行时模块只使用典型的@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> 
+0

我已经玩弄了一些更有效的构建策略,将工作。但是,我知道这是一个适合每个人的工作。 –