Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Include UI project when generating application from archetype #117

Merged
merged 1 commit into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.nio.file.Files
import java.nio.file.Path

// Detect node npx runner
def launcher = System.properties['os.name'].toLowerCase().contains('windows') ? "npx.cmd" : "npx"

// Run create-react-app with latest @tesler-ui/cra-template-typescript
def cmd = "${launcher} create-react-app ${request.outputDirectory}/${request.artifactId}/${request.artifactId}-ui --template @tesler-ui/cra-template-typescript"
def proc = cmd.execute(null, new File(request.outputDirectory))
proc.consumeProcessOutput(System.out, System.err)
proc.waitFor()

// Move UI pom from archetype to CRA-generated folder
String pomLocation = "${request.outputDirectory}/${request.artifactId}/${request.artifactId}-ui-template"
Path pom = Path.of("${pomLocation}/pom.xml")
Path ui = Path.of("${request.outputDirectory}/${request.artifactId}/${request.artifactId}-ui/pom.xml")
Files.copy(pom, ui)
Files.delete(pom)
Files.delete(Path.of(pomLocation))

println "\nDone. Exit value: ${proc.exitValue()}"
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@
<include>pom.xml</include>
</includes>
</fileSet>
<fileSet filtered="true">
<directory>__rootArtifactId__-ui-template</directory>
<includes>
<include>pom.xml</include>
</includes>
</fileSet>
</fileSets>

</archetype-descriptor>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<groupId>${dollar.sign}{groupId}</groupId>
<artifactId>${dollar.sign}{rootArtifactId}-db</artifactId>
</dependency>
<dependency>
<groupId>${dollar.sign}{groupId}</groupId>
<artifactId>${dollar.sign}{rootArtifactId}-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@

<spring.version>${spring.version}</spring.version>
<spring-boot.version>${spring-boot.version}</spring-boot.version>
<liquibase.version>${liquibase.version}</liquibase.version>
<slf4j.version>${slf4j.version}</slf4j.version>
<tesler.version>${version}</tesler.version>

<junit.jupiter.version>${junit.jupiter.version}</junit.jupiter.version>
<junit.platform.version>${junit.platform.version}</junit.platform.version>
<surefire.version>${surefire.version}</surefire.version>
<mockito.version>${mockito.version}</mockito.version>

<!-- build settings -->
<spring.active.profiles/>
Expand Down Expand Up @@ -81,9 +75,9 @@
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${dollar.sign}{spring.version}</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${dollar.sign}{spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -127,13 +121,6 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${dollar.sign}{slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${dollar.sign}{liquibase.version}</version>
</dependency>

<dependency>
Expand All @@ -142,13 +129,6 @@
<version>2.6.0</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
Expand All @@ -173,41 +153,11 @@
<version>1.3.2</version>
</dependency>


<!-- Test -->

<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${dollar.sign}{junit.jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${dollar.sign}{junit.jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${dollar.sign}{junit.platform.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${dollar.sign}{mockito.version}</version>
<scope>test</scope>
</dependency>

Expand All @@ -224,13 +174,6 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${dollar.sign}{spring.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
</dependencyManagement>

Expand All @@ -254,7 +197,6 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${dollar.sign}{liquibase.version}</version>
<dependencies>
<dependency>
<groupId>io.tesler</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
<version>${dollar.sign}{version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>${dollar.sign}{groupId}</groupId>
<artifactId>${dollar.sign}{rootArtifactId}-ui</artifactId>
<version>${dollar.sign}{version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@
<groupId>io.tesler</groupId>
<artifactId>tesler-liquibase</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<skip>false</skip>
<driver>${dollar.sign}{jdbc.driver}</driver>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>${dollar.sign}{rootArtifactId}-ui</artifactId>
<packaging>jar</packaging>
<version>${dollar.sign}{version}</version>
<name>${dollar.sign}{appUpperCaseName} - UI</name>

<parent>
<groupId>${dollar.sign}{groupId}</groupId>
<artifactId>${dollar.sign}{rootArtifactId}-base</artifactId>
<version>${dollar.sign}{version}</version>
<relativePath>../${dollar.sign}{rootArtifactId}-base/pom.xml</relativePath>
</parent>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>node_modules</directory>
</fileset>
<fileset>
<directory>build</directory>
</fileset>
</filesets>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<workingDirectory>${dollar.sign}{project.basedir}</workingDirectory>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-npm-run-build</id>
<phase>generate-sources</phase>
<configuration>
<workingDirectory>${dollar.sign}{project.basedir}</workingDirectory>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>ui-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${dollar.sign}{project.build.outputDirectory}/ui</outputDirectory>
<resources>
<resource>
<directory>${dollar.sign}{project.basedir}/build</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

</plugins>

</build>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<module>${dollar.sign}{rootArtifactId}-it</module>
</modules>
</profile>
<profile>
<id>UI</id>
<modules>
<module>${dollar.sign}{rootArtifactId}-ui</module>
</modules>
</profile>
</profiles>

<modules>
Expand Down