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

Bug Report: Maven regex-profile-activator extension seems not to work in Maven 3.9/FISH-9752 #93

Open
sroughley opened this issue Sep 9, 2024 · 2 comments
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect

Comments

@sroughley
Copy link

Brief Summary

Regex-based profile activation appears not to work using regex-profile-activator with Mavn 3.9.9

Expected Outcome

A maven profile should be activated when using this plugin during compilation

Current Outcome

The profile activation appears not to be happening

Reproducer

Creating a simple empty Maven project with the following pom.xml file:

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.vernalis</groupId>
	<artifactId>bugreport</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<properties>
		<payara.version>0.5</payara.version>
		<keyword>5.2</keyword>
	</properties>

	<profiles>
		<profile>
			<id>test-keyword</id>
			<activation>
				<property>
					<name>keyword</name>
					<value>/test.*/</value>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>3.1.0</version>
						<executions>
							<execution>
								<id>test-print</id>
								<phase>clean</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<echo message="TEST Profile active" />
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<dependencies>
		<dependency>
			<groupId>fish.payara.maven.extensions</groupId>
			<artifactId>regex-profile-activator</artifactId>
			<version>${payara.version}</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<id>version-print</id>
						<phase>clean</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<echo message="Keyword: ${keyword}" />
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

and running the following command:

mvn clean -Dkeyword=testing

Should activate the test-keyword profile as shown by the phrase TEST Profile active appearing in the console output, however this does not happen, e.g.:

$ mvn clean -Dkeyword=testing
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.vernalis:bugreport >-----------------------
[INFO] Building bugreport 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ bugreport ---
[INFO] Deleting E:\bugreport\target
[INFO]
[INFO] --- antrun:3.1.0:run (version-print) @ bugreport ---
[INFO] Executing tasks
[WARNING]      [echo] Keyword: testing
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.653 s
[INFO] Finished at: 2024-09-09T13:33:42+01:00
[INFO] ------------------------------------------------------------------------

However, changing the <value> entry to a simple <value>testing</value> in the pom.x,ml and repeating shows the profile activated by the conventional means:

$ mvn clean -Dkeyword=testing
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.vernalis:bugreport >-----------------------
[INFO] Building bugreport 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ bugreport ---
[INFO] Deleting E:\bugreport\target
[INFO]
[INFO] --- antrun:3.1.0:run (version-print) @ bugreport ---
[INFO] Executing tasks
[WARNING]      [echo] Keyword: testing
[INFO] Executed tasks
[INFO]
[INFO] --- antrun:3.1.0:run (test-print) @ bugreport ---
[INFO] Executing tasks
[WARNING]      [echo] TEST Profile active
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.696 s
[INFO] Finished at: 2024-09-09T13:28:32+01:00
[INFO] ------------------------------------------------------------------------

Maven / JDK version as shown:

$ mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: C:\Program Files\Apache\apache-maven-3.9.6
Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-21.0.3.9-hotspot
Default locale: en_GB, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Operating System

Win11 Pro 23H2

JDK Version

Eclips Adoptium 21.0.3

Ecosystem Tool

Maven Regex Extension

@sroughley sroughley added Status: Open Issue has been triaged by the front-line engineers and is being worked on verification Type: Bug Label issue as a bug defect labels Sep 9, 2024
@fturizo fturizo assigned felixif and unassigned artur-mal Sep 17, 2024
@felixif
Copy link

felixif commented Sep 19, 2024

Hello @sroughley,

I can confirm that the plugin does not seem to function at all based on your reproducer. I tried using older versions of Mavenm an older JDK and different combinations of regular expressions, without any success. I have raised an internal issue, codename FISH-9752, and the Platform Development team will have a look into this issue.

Thank you very much for your report!

Best regards,
Felix

@felixif felixif added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification labels Sep 19, 2024
@felixif felixif changed the title Bug Report: Maven regex-profile-activator extension seems not to work in Maven 3.9 Bug Report: Maven regex-profile-activator extension seems not to work in Maven 3.9/FISH-9752 Sep 19, 2024
@sroughley
Copy link
Author

Hi Felix,

Thanks for the update!

Steve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

3 participants