IDEMPIERE-5392 Maven Build: add flag to skip auto clean (#1447)

* IDEMPIERE-5392 Maven Build: add flag to skip auto clean

* IDEMPIERE-5392 Maven Build: add flag to skip auto clean

- Add -DmaterializeProduct flag. Use -DmaterializeProduct=none to turn
off part of org.idempiere.p2 build.
- Add parallel execution setting for test.

* IDEMPIERE-5392 Maven Build: add flag to skip auto clean

- handle potential multi threaded conflict on context property
This commit is contained in:
hengsin 2022-08-22 23:09:33 +08:00 committed by GitHub
parent ab78a8acbd
commit 360861e300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 108 additions and 34 deletions

View File

@ -11,29 +11,6 @@
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>auto-clean</id>
<phase>validate</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/lib</directory>
<includes>
<include>*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>

View File

@ -9,20 +9,82 @@
</parent>
<artifactId>org.idempiere.p2</artifactId>
<packaging>eclipse-repository</packaging>
<properties>
<materializeProduct>package</materializeProduct>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete file="${project.basedir}/target/local-artifacts.properties" quiet="true"/>
<delete
dir="${project.basedir}/target/repository" quiet="true"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-publisher-plugin</artifactId>
<executions>
<execution>
<id>default-publish-osgi-ee</id>
<goals>
<goal>publish-osgi-ee</goal>
</goals>
<phase>${materializeProduct}</phase>
</execution>
<execution>
<id>default-publish-categories</id>
<goals>
<goal>publish-categories</goal>
</goals>
<phase>${materializeProduct}</phase>
</execution>
<execution>
<id>default-publish-products</id>
<goals>
<goal>publish-products</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>default-attach-artifacts</id>
<goals>
<goal>attach-artifacts</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<executions>
<execution>
<!-- install the product using the p2 director -->
<id>build-site-p2</id>
<id>default-assemble-repository</id>
<goals>
<goal>assemble-repository</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>default-archive-repository</id>
<goals>
<goal>archive-repository</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
@ -34,17 +96,17 @@
<xzCompress>false</xzCompress>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<executions>
<execution>
<!-- install the product using the p2 director -->
<id>materialize-products</id>
<id>default-materialize-products</id>
<goals>
<goal>materialize-products</goal>
</goals>
<phase>${materializeProduct}</phase>
</execution>
</executions>
<configuration>
@ -58,7 +120,6 @@
</products>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
@ -67,10 +128,11 @@
</configuration>
<executions>
<execution>
<id>default-eclipse-run</id>
<goals>
<goal>eclipse-run</goal>
</goals>
<phase>package</phase>
<phase>${materializeProduct}</phase>
</execution>
</executions>
</plugin>

View File

@ -31,6 +31,7 @@
<url.file.srv>https://raw.githubusercontent.com/idempiere/binary.file/master</url.file.srv>
<extra.ui.install>org.eclipse.equinox.p2.director, org.idempiere.equinox.p2.director.feature.feature.group, org.idempiere.test.feature.feature.group</extra.ui.install>
<idempiere.product.id>org.adempiere.server.product</idempiere.product.id>
<skipClean>false</skipClean>
</properties>
<build>
@ -505,6 +506,7 @@
</execution>
</executions>
<configuration>
<skip>${skipClean}</skip>
<filesets>
<fileset>
<directory>${project.basedir}/lib</directory>

View File

@ -14,16 +14,45 @@
<idempiere.home>..</idempiere.home>
<skipTests>true</skipTests>
<sonar.skip>true</sonar.skip>
<p1>-Djunit.jupiter.execution.parallel.enabled=true</p1>
<p2>-Djunit.jupiter.execution.parallel.mode.default=concurrent</p2>
<p3>-Djunit.jupiter.execution.parallel.config.strategy=fixed</p3>
<p4>-Djunit.jupiter.execution.parallel.config.fixed.parallelism=4</p4>
<p5>-Djunit.jupiter.execution.parallel.mode.classes.default=same_thread</p5>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>auto-clean</id>
<phase>validate</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>false</skip>
<filesets>
<fileset>
<directory>${project.basedir}/lib</directory>
<includes>
<include>*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<argLine>
-DIDEMPIERE_HOME=${idempiere.home}
-DIDEMPIERE_HOME=${idempiere.home} ${p1} ${p2} ${p3} ${p4} ${p5}
</argLine>
<testRuntime>p2Installed</testRuntime>
<skipTests>${skipTests}</skipTests>

View File

@ -28,7 +28,9 @@ import static org.junit.jupiter.api.Assertions.fail;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Properties;
import org.adempiere.util.ServerContext;
import org.compiere.Adempiere;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MClientInfo;
@ -71,6 +73,8 @@ public abstract class AbstractTestCase {
* @param testInfo
*/
protected void init(TestInfo testInfo) {
ServerContext.setCurrentInstance(new Properties());
String trxName = Trx.createTrxName(getClass().getName()+"_");
trx = Trx.get(trxName, true);
trx.start();