Skip to content

Commit

Permalink
build: enable test jar if not maven skip test; add deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed May 15, 2023
1 parent 12d8c25 commit fd7ca54
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 37 deletions.
42 changes: 29 additions & 13 deletions cffu-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,39 @@
</dependency>

<!-- testing libs -->
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-utils</artifactId>
<version>${project.version}</version>
<!--
Guide to using attached tests
reuse the tests that you have created for one project in another
https://maven.apache.org/guides/mini/guide-attached-tests.html
-->
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>enable-test-jar-if-not-maven-skip-test</id>
<activation>
<property>
<name>maven.test.skip</name>
<value>!true</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-utils</artifactId>
<version>${project.version}</version>
<!--
Guide to using attached tests
reuse the tests that you have created for one project in another
https://maven.apache.org/guides/mini/guide-attached-tests.html
How to create a jar containing test classes
https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html
-->
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
47 changes: 30 additions & 17 deletions cffu-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,35 @@
<artifactId>kotlin-stdlib-jdk8</artifactId>
<optional>true</optional>
</dependency>
<!-- testing libs -->
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-utils</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>enable-test-jar-if-not-maven-skip-test</id>
<activation>
<property>
<name>maven.test.skip</name>
<value>!true</value>
</property>
</activation>
<dependencies>
<!-- testing libs -->
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-utils</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
38 changes: 31 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -437,6 +430,37 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>enable-test-jar-if-not-maven-skip-test</id>
<activation>
<property>
<name>maven.test.skip</name>
<value>!true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<!--
Guide to using attached tests
reuse the tests that you have created for one project in another
https://maven.apache.org/guides/mini/guide-attached-tests.html
How to create a jar containing test classes
https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html
-->
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>gen-src</id>
<activation>
Expand Down
17 changes: 17 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -eEuo pipefail
cd "$(dirname "$(readlink -f "$0")")/.."

source "scripts/bash-buddy/lib/common_utils.sh"

readonly jh_var_name="JAVA19_HOME"
[ -d "${!jh_var_name:-}" ] ||
cu::die "\$${jh_var_name}(${!jh_var_name:-}) dir is not existed!"
export JAVA_HOME="${!jh_var_name}"

rm -rf "$HOME/.m2/repository/io/foldright"/cffu*
scripts/integration_test

rm -rf "$HOME/.m2/repository/io/foldright"/cffu*
cu::log_then_run ./mvnw clean
cu::log_then_run ./mvnw deploy -DperformRelease -Dmaven.test.skip

0 comments on commit fd7ca54

Please sign in to comment.