Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use frontend plugin to build web-client #131

Merged
merged 3 commits into from
Mar 10, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.gradle/
.classpath
.project
.factorypath
.settings/
**/*.class
build/
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ for multi-container demos of this project.
Build:
- Git
- JDK11+
- Maven
- Maven 3+
- Podman
- npm 6+
- Node 12+

Run:
- Kubernetes/OpenShift/Minishift, Podman/Docker, or other container platform
Expand All @@ -32,14 +30,11 @@ required dependency, which is not currently published in an artefact repository
and so must be built and installed into the Maven local repository.
Instructions for doing so are available at that project's README.

Submodules must be initialized via `git submodule init && git submodule update`.

`container-jfr-web`, as a submodule located within the `web-client` directory,
must be prepared by running `pushd web-client; npm ci; popd`.

Once the `container-jfr-core` local dependency is made available,
`mvn compile` will build the project.

Submodules must be initialized via `git submodule init && git submodule update`.

Tests can be run with `mvn test`. Additional quality tools can be run with
`mvn verify`.

Expand Down
178 changes: 100 additions & 78 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<maven.compiler.source>${java.version}</maven.compiler.source>

<imageBuilder>/usr/bin/podman</imageBuilder>
<node.version>v12.5.0</node.version>
<npm.version>6.13.4</npm.version>

<containerjfr.minimal>false</containerjfr.minimal>
<containerjfr.imageStream>quay.io/rh-jmc-team/container-jfr</containerjfr.imageStream>
Expand All @@ -31,6 +33,7 @@
<org.apache.maven.plugins.info.reports.version>3.0.0</org.apache.maven.plugins.info.reports.version>
<org.apache.maven.plugins.clean.version>3.1.0</org.apache.maven.plugins.clean.version>
<org.apache.maven.plugins.resources.version>3.1.0</org.apache.maven.plugins.resources.version>
<com.github.eirslett.frontend.plugin.version>1.9.1</com.github.eirslett.frontend.plugin.version>
<org.codehaus.mojo.exec.plugin.version>1.6.0</org.codehaus.mojo.exec.plugin.version>
<com.google.cloud.tools.jib.maven.plugin.version>2.1.0</com.google.cloud.tools.jib.maven.plugin.version>

Expand Down Expand Up @@ -163,6 +166,65 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${org.codehaus.mojo.exec.plugin.version}</version>
<configuration>
<mainClass>com.redhat.rhjmc.containerjfr.ContainerJfr</mainClass>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.directory}/assets/app/resources</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${imageBuilder}</executable>
<arguments>
<argument>run</argument>
<argument>--hostname=container-jfr</argument>
<argument>--name=container-jfr-itest</argument>
<argument>--publish</argument>
<argument>9091:9091</argument>
<argument>--publish</argument>
<argument>${containerjfr.itest.webPort}:${containerjfr.itest.webPort}</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_LOG_LEVEL=ALL</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_WEB_HOST=0.0.0.0</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_LISTEN_HOST=0.0.0.0</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_WEB_PORT=${containerjfr.itest.webPort}</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_EXT_WEB_PORT=${containerjfr.itest.webPort}</argument>
<argument>--detach</argument>
<argument>--rm</argument>
<argument>${containerjfr.imageStream}:${containerjfr.imageVersion}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${imageBuilder}</executable>
<arguments>
<argument>kill</argument>
<argument>container-jfr-itest</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -355,108 +417,68 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${org.codehaus.mojo.exec.plugin.version}</version>
<artifactId>maven-clean-plugin</artifactId>
<version>${org.apache.maven.plugins.clean.version}</version>
<configuration>
<mainClass>com.redhat.rhjmc.containerjfr.ContainerJfr</mainClass>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.directory}/assets/app/resources</additionalClasspathElement>
</additionalClasspathElements>
<filesets>
<fileset>
<directory>web-client</directory>
<includes>
<include>node_modules/**</include>
<include>dist/**</include>
</includes>
</fileset>
<fileset>
<directory>bin</directory>
<includes>
<include>node/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${com.github.eirslett.frontend.plugin.version}</version>
<configuration>
<workingDirectory>${project.basedir}/web-client</workingDirectory>
<installDirectory>${project.basedir}/bin</installDirectory>
</configuration>
<executions>
<execution>
<id>update-web-client-deps</id>
<id>install node and npm</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<executable>npm</executable>
<workingDirectory>web-client</workingDirectory>
<arguments>
<argument>ci</argument>
</arguments>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
</configuration>
</execution>
<execution>
<id>build-web-client</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<workingDirectory>web-client</workingDirectory>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<id>npm ci</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
<goal>npm</goal>
</goals>
<configuration>
<executable>${imageBuilder}</executable>
<arguments>
<argument>run</argument>
<argument>--hostname=container-jfr</argument>
<argument>--name=container-jfr-itest</argument>
<argument>--publish</argument>
<argument>9091:9091</argument>
<argument>--publish</argument>
<argument>${containerjfr.itest.webPort}:${containerjfr.itest.webPort}</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_LOG_LEVEL=ALL</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_WEB_HOST=0.0.0.0</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_LISTEN_HOST=0.0.0.0</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_WEB_PORT=${containerjfr.itest.webPort}</argument>
<argument>--env</argument>
<argument>CONTAINER_JFR_EXT_WEB_PORT=${containerjfr.itest.webPort}</argument>
<argument>--detach</argument>
<argument>--rm</argument>
<argument>${containerjfr.imageStream}:latest</argument>
</arguments>
<arguments>ci</arguments>
</configuration>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<id>npm run build</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
<goal>npm</goal>
</goals>
<configuration>
<executable>${imageBuilder}</executable>
<arguments>
<argument>kill</argument>
<argument>container-jfr-itest</argument>
</arguments>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${org.apache.maven.plugins.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>web-client</directory>
<includes>
<include>node_modules/**</include>
<include>dist/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${org.apache.maven.plugins.resources.version}</version>
Expand Down