Skip to content

Commit

Permalink
Slight updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Jul 8, 2024
1 parent c655e4d commit 94bf275
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 21 deletions.
21 changes: 16 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>io.takari</groupId>
<artifactId>takari</artifactId>
<version>53</version>
<version>55</version>
</parent>

<groupId>io.takari.maven.plugins</groupId>
Expand All @@ -36,10 +36,10 @@
</scm>

<properties>
<mavenVersion>3.9.6</mavenVersion>
<sisuVersion>0.9.0.M2</sisuVersion>
<mavenVersion>3.9.8</mavenVersion>
<sisuVersion>0.9.0.M3</sisuVersion>
<sisuGuiceVersion>6.0.0</sisuGuiceVersion>
<aetherVersion>1.9.18</aetherVersion>
<aetherVersion>1.9.21</aetherVersion>
<slf4jVersion>1.7.36</slf4jVersion>
</properties>

Expand All @@ -53,7 +53,7 @@
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.2</version>
<version>5.10.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -62,6 +62,16 @@
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
</dependency>

<!-- unit testing -->
<dependency>
Expand Down Expand Up @@ -138,6 +148,7 @@
</dependency>

<!-- automatic resolution of maven runtimes during integration tests -->
<!-- Note: this compress must work with commons-io in Maven: 1.26.1 requires Maven 3.8! -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
Expand Down
1 change: 0 additions & 1 deletion takari-plugin-integration-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>

</dependencies>

</project>
5 changes: 3 additions & 2 deletions takari-plugin-testing-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
<executions>
<execution>
<id>unpack</id>
Expand All @@ -117,7 +118,7 @@
</goals>
<phase>generate-test-resources</phase>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<outputDirectory>${project.build.directory}/maven-installation</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.apache.maven</groupId>
Expand All @@ -136,7 +137,7 @@
<artifactItem>
<groupId>org.apache.maven</groupId>
<artifactId>apache-maven</artifactId>
<version>3.9.6</version>
<version>3.9.8</version>
<classifier>bin</classifier>
<type>tar.gz</type>
</artifactItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static List<Object[]> versions() {
List<Object[]> parameters = new ArrayList<>();
parameters.add(new Object[] {"3.6.3"});
parameters.add(new Object[] {"3.8.8"});
parameters.add(new Object[] {"3.9.6"});
parameters.add(new Object[] {"3.9.8"});
return parameters;
}

Expand All @@ -46,7 +46,7 @@ public static List<Object[]> versions() {

public IntegrationTest(String version) throws Exception {
this.version = version;
File mavenHome = new File("target/apache-maven-" + version);
File mavenHome = new File("target/maven-installation/apache-maven-" + version);
this.maven = MavenRuntime.builder(mavenHome, null).forkedBuilder().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.extension.RegisterExtension;

@MavenInstallations({"target/apache-maven-3.6.3", "target/apache-maven-3.8.8", "target/apache-maven-3.9.6"})
@MavenInstallations({
"target/maven-installation/apache-maven-3.6.3",
"target/maven-installation/apache-maven-3.8.8",
"target/maven-installation/apache-maven-3.9.8"
})
public class JUnit5IntegrationTests {

@RegisterExtension
Expand All @@ -36,7 +40,8 @@ void testBasic() throws Exception {
"package basic; class TargetVersion { static final String VERSION = \"" + this.version + "\"; }");

this.maven
.forProject(basedir) //
.forProject(basedir)
.withCliOption("-e") //
.execute("package") //
.assertErrorFreeLog();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ void testUnitTestHarnessHonoursUserSettings(MavenRuntime maven, String version)
static final class MavenVersionsSource implements ArgumentsProvider {

private List<String> getMavenVersions() {
return Arrays.asList("3.6.3", "3.8.8", "3.9.6");
return Arrays.asList("3.6.3", "3.8.8", "3.9.8");
}

@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) throws Exception {
List<String> mavenVersions = this.getMavenVersions();
List<Arguments> arguments = new ArrayList<>(mavenVersions.size());
for (String version : mavenVersions) {
File mavenHome = new File("target/apache-maven-" + version);
File mavenHome = new File("target/maven-installation/apache-maven-" + version);
MavenRuntime maven =
MavenRuntime.builder(mavenHome, null).forkedBuilder().build();
arguments.add(Arguments.of(maven, version));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public IntegrationTest(MavenRuntimeBuilder builder) throws Exception {
@Test
public void testBasic() throws Exception {
File basedir = resources.getBasedir("basic");
maven.forProject(basedir).execute("validate").assertErrorFreeLog();
maven.forProject(basedir).withCliOptions("-e").execute("validate").assertErrorFreeLog();
TestResources.assertFilesPresent(basedir, "target/output.txt");
}

Expand Down
10 changes: 9 additions & 1 deletion takari-plugin-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>runtime</scope>
</dependency>

<!-- unit testing -->
<dependency>
Expand Down Expand Up @@ -111,5 +120,4 @@
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Map;

public class MavenRuntime {

private final MavenLauncher launcher;

private final TestProperties properties;
Expand All @@ -30,6 +29,8 @@ public static class MavenRuntimeBuilder {

protected final File mavenHome;

protected final String mavenVersion;

protected final File classworldsConf;

protected final List<String> extensions = new ArrayList<>();
Expand All @@ -39,6 +40,7 @@ public static class MavenRuntimeBuilder {
MavenRuntimeBuilder(File mavenHome, File classworldsConf) {
this.properties = new TestProperties();
this.mavenHome = mavenHome;
this.mavenVersion = MavenInstallationUtils.getMavenVersion(mavenHome, classworldsConf);
this.classworldsConf = classworldsConf;

StringBuilder workspaceState = new StringBuilder();
Expand All @@ -47,7 +49,7 @@ public static class MavenRuntimeBuilder {

String workspaceResolver = properties.get("workspaceResolver");
if (workspaceState.length() > 0 && isFile(workspaceResolver)) {
if ("3.2.1".equals(MavenInstallationUtils.getMavenVersion(mavenHome, classworldsConf))) {
if ("3.2.1".equals(mavenVersion)) {
throw new IllegalArgumentException(
"Maven 3.2.1 is not supported, see https://jira.codehaus.org/browse/MNG-5591");
}
Expand All @@ -72,6 +74,7 @@ private void appendLocation(StringBuilder workspaceState, String location) {
MavenRuntimeBuilder(File mavenHome, File classworldsConf, List<String> extensions, List<String> args) {
this.properties = new TestProperties();
this.mavenHome = mavenHome;
this.mavenVersion = MavenInstallationUtils.getMavenVersion(mavenHome, classworldsConf);
this.classworldsConf = classworldsConf;
this.extensions.addAll(extensions);
this.args.addAll(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public void resolve(String[] versions) throws Exception {
"Cannot test %s plugin release with %s maven", properties.getPluginVersion(), version);
error(version, new IllegalStateException(msg));
}
File basdir = new File("target/maven-installation").getCanonicalFile();
File mavenHome = new File(basdir, "apache-maven-" + version).getCanonicalFile();
File basedir = new File("target/maven-installation").getCanonicalFile();
File mavenHome = new File(basedir, "apache-maven-" + version).getCanonicalFile();
if (!mavenHome.isDirectory()) {
if (repositories == null) {
repositories = getRepositories(properties);
}
Authenticator defaultAuthenticator = getDefaultAuthenticator();
try {
createMavenInstallation(repositories, version, properties.getLocalRepository(), basdir);
createMavenInstallation(repositories, version, properties.getLocalRepository(), basedir);
} catch (Exception e) {
error(version, e);
} finally {
Expand Down

0 comments on commit 94bf275

Please sign in to comment.