3

I am trying to implement simple web application with Extjs 6 - And Spring boot stack.

Using sencha cmd we can create the standalone Extjs application. But I need to have this application as a part of my Spring Boot Web Application. It should get added into WAR file build by spring boot.

How should my spring web application structure should be?

How to build using sencha cmd and spring boot together?

Searched a lot on this, but could not find appropriate answer.

Chaitu
  • 61
  • 5
  • Have you read the docs about [spring boot + angularjs](https://spring.io/blog/2015/01/12/spring-and-angular-js-a-secure-single-page-application)? I'm pretty sure a similar setup will work with any spa including Extjs. – miensol May 16 '16 at 10:10
  • 1
    It is using the wro4j, which is not yet fully supported for extjs 6. My question is how to integrate the application created using sencha cmd into spring boot web app. Or how to use sencha cmd to compile/package spring boot web application having extjs ui. – Chaitu May 16 '16 at 10:41
  • are you using maven or gradle? – Hernan Payrumani May 22 '16 at 02:11
  • 1
    I am using Maven. I found one solution to setup using maven build. Need to use exec plugin in maven build and copy the sencha build output to webapp. – Chaitu May 25 '16 at 11:44
  • i m asking same questions here : http://stackoverflow.com/questions/43634461/stack-extjs-6-spring-boot do you find a solution ? – mik3fly-4steri5k May 03 '17 at 14:27

1 Answers1

0

With Spring Boot we generally do things now as jar's and package them inside the jar. The embedded web server can serve the contents from the jar directly. You would use a WAR file with Jboss or other application server.

In your runtime module just use your typical @SpringBootApplication and pull

I use this in my 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
  • 376
  • 2
  • 13
  • I've toyed around with some more efficient build strategies that will work. But offhand I know this one will work for everyone. – Mike Samaras Feb 28 '18 at 13:05