-
Notifications
You must be signed in to change notification settings - Fork 98
Added support for maven property references in copyDependencies
#1934
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
Merged
venmanyarun
merged 11 commits into
OpenLiberty:main
from
sajeerzeji:GH1760-Support_for_Maven_property_references_in_copyDependencies
Oct 28, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
02ed9db
Created a method to resolve dependency property references
b6bc125
Integrated resolveDependencyPropertyReferences method
f5600e6
Integrated resolvePropertyReferences method
6f15d8d
Changed the logic of resolvePropertyReferences
f28950c
Created a method replaceStringLiteral in BaseDevTest which will be us…
68da477
Added pg properties to /basic-dev-project/pom.xml
6101c30
Replaced maven dependency config under <dependency> and <copyDependen…
b85c1e8
Changed replaceString to replaceStringLiteral so that $ value will ge…
2b32ec6
Fixed the Matcher import issue in IT
90e51da
Added a new test to verify that Maven properties used in the location…
b9cf6f5
ci.common version updated
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...-it/src/test/java/net/wasdev/wlp/test/dev/it/DevCopyDependenciesLocationPropertyTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /******************************************************************************* | ||
| * (c) Copyright IBM Corporation 2025. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| *******************************************************************************/ | ||
| package net.wasdev.wlp.test.dev.it; | ||
|
|
||
| import static org.junit.Assert.*; | ||
|
|
||
| import java.io.File; | ||
|
|
||
| import org.junit.AfterClass; | ||
| import org.junit.BeforeClass; | ||
| import org.junit.Test; | ||
|
|
||
| /** | ||
| * Test property resolution in copyDependencies location paths. | ||
| * This test verifies that Maven properties used in the location attribute | ||
| * of dependencyGroups are correctly resolved. | ||
| */ | ||
| public class DevCopyDependenciesLocationPropertyTest extends BaseDevTest { | ||
|
|
||
| @BeforeClass | ||
| public static void setUpBeforeClass() throws Exception { | ||
| setUpBeforeClass(null, "../resources/basic-dev-project", true, false, null, null); | ||
|
|
||
| // Add a provided-scoped dependency with property references | ||
| String additionalDependencies = "<dependency> <groupId>${pg.group.id}</groupId> <artifactId>${pg.artifact.id}</artifactId> <version>${pg.version}</version> <scope>provided</scope> </dependency>"; | ||
| replaceStringLiteral("<!-- ADDITIONAL_DEPENDENCIES -->", additionalDependencies, pom); | ||
|
|
||
| // Configure copyDependencies with property reference in location | ||
| String additionalConfiguration = "<copyDependencies> <dependencyGroup> <location>${custom.dir.location}</location> <dependency> <groupId>${pg.group.id}</groupId> <artifactId>${pg.artifact.id}</artifactId> </dependency> </dependencyGroup> </copyDependencies>"; | ||
| replaceStringLiteral("<!-- ADDITIONAL_CONFIGURATION -->", additionalConfiguration, pom); | ||
|
|
||
| startProcess(null, true); | ||
| } | ||
|
|
||
| @AfterClass | ||
| public static void cleanUpAfterClass() throws Exception { | ||
| BaseDevTest.cleanUpAfterClass(); | ||
| } | ||
|
|
||
| @Test | ||
| public void propertyResolutionTest() throws Exception { | ||
| // This test verifies that Maven properties are resolved correctly in: | ||
| // 1. Dependency variables (${pg.group.id}, ${pg.artifact.id}, etc) | ||
| // 2. Location path (${custom.dir.location}) | ||
|
|
||
| // Verify the dependency was copied successfully with resolved filename | ||
| assertTrue("Dependency copy log message not found: " + getLogTail(), | ||
| verifyLogMessageExists("copyDependencies copied file postgresql-42.1.1.jar", 2000)); | ||
|
|
||
| // Verify that the location property was resolved (customDirLocation instead of ${custom.dir.location}) | ||
| assertTrue("Location property resolution failed - expected 'customDirLocation' in log: "+getLogTail(), | ||
| verifyLogMessageExists("customDirLocation", 2000)); | ||
|
|
||
| // Verify the file exists at the resolved location | ||
| File f = new File(targetDir, "liberty/wlp/usr/servers/defaultServer/customDirLocation/postgresql-42.1.1.jar"); | ||
| assertTrue("Dependency was not copied to the resolved location: " + f.getAbsolutePath(), f.exists()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.