mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-25 16:27:11 -07:00
Support the provided scope by the PomBuilder class
This commit is contained in:
parent
e65668a8be
commit
4f20fb2cc7
2 changed files with 50 additions and 17 deletions
|
@ -152,6 +152,7 @@ public class PomBuilder {
|
||||||
if (dependencies() != null && !dependencies().isEmpty()) {
|
if (dependencies() != null && !dependencies().isEmpty()) {
|
||||||
addDependencies(t, Scope.compile);
|
addDependencies(t, Scope.compile);
|
||||||
addDependencies(t, Scope.runtime);
|
addDependencies(t, Scope.runtime);
|
||||||
|
addDependencies(t, Scope.provided);
|
||||||
t.setBlock("dependencies-tag");
|
t.setBlock("dependencies-tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,6 +419,41 @@ public class TestPomBuilder {
|
||||||
""", builder.build());
|
""", builder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testDependenciesProvided() {
|
||||||
|
var builder = new PomBuilder();
|
||||||
|
builder.dependencies().scope(Scope.provided)
|
||||||
|
.include(new Dependency("org.eclipse.jetty.ee10", "jetty-ee10", new VersionNumber(12,0,7)))
|
||||||
|
.include(new Dependency("org.eclipse.jetty.ee10", "jetty-ee10-servlet", new VersionNumber(12,0,7)));
|
||||||
|
assertEquals("""
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId></groupId>
|
||||||
|
<artifactId></artifactId>
|
||||||
|
<version></version>
|
||||||
|
<name></name>
|
||||||
|
<description></description>
|
||||||
|
<url></url>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty.ee10</groupId>
|
||||||
|
<artifactId>jetty-ee10</artifactId>
|
||||||
|
<version>12.0.7</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty.ee10</groupId>
|
||||||
|
<artifactId>jetty-ee10-servlet</artifactId>
|
||||||
|
<version>12.0.7</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
""", builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDependencies() {
|
void testDependencies() {
|
||||||
var builder = new PomBuilder();
|
var builder = new PomBuilder();
|
||||||
|
@ -428,9 +463,10 @@ public class TestPomBuilder {
|
||||||
.include(new Dependency("org.springframework.boot", "spring-boot-starter", new VersionNumber(3, 0, 4))
|
.include(new Dependency("org.springframework.boot", "spring-boot-starter", new VersionNumber(3, 0, 4))
|
||||||
.exclude("*", "artifactId"));
|
.exclude("*", "artifactId"));
|
||||||
builder.dependencies().scope(Scope.runtime)
|
builder.dependencies().scope(Scope.runtime)
|
||||||
.include(new Dependency("com.uwyn.rife2", "rife2", VersionNumber.UNKNOWN, "agent"))
|
.include(new Dependency("com.uwyn.rife2", "rife2", VersionNumber.UNKNOWN, "agent"));
|
||||||
.include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11, 0, 14))
|
builder.dependencies().scope(Scope.provided)
|
||||||
.exclude("*", "*").exclude("groupId", "artifactId"));
|
.include(new Dependency("org.eclipse.jetty.ee10", "jetty-ee10", new VersionNumber(12,0,7)))
|
||||||
|
.include(new Dependency("org.eclipse.jetty.ee10", "jetty-ee10-servlet", new VersionNumber(12,0,7)));
|
||||||
assertEquals("""
|
assertEquals("""
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
@ -475,20 +511,16 @@ public class TestPomBuilder {
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty.ee10</groupId>
|
||||||
<artifactId>jetty-server</artifactId>
|
<artifactId>jetty-ee10</artifactId>
|
||||||
<version>11.0.14</version>
|
<version>12.0.7</version>
|
||||||
<scope>runtime</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
</dependency>
|
||||||
<exclusion>
|
<dependency>
|
||||||
<groupId>*</groupId>
|
<groupId>org.eclipse.jetty.ee10</groupId>
|
||||||
<artifactId>*</artifactId>
|
<artifactId>jetty-ee10-servlet</artifactId>
|
||||||
</exclusion>
|
<version>12.0.7</version>
|
||||||
<exclusion>
|
<scope>provided</scope>
|
||||||
<groupId>groupId</groupId>
|
|
||||||
<artifactId>artifactId</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue