-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignoredEntries from plugins is now used
Add Maven tests
- Loading branch information
Showing
11 changed files
with
317 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
51 changes: 51 additions & 0 deletions
51
integration-tests/maven/src/test/java/io/quarkus/maven/it/IgnoreEntriesIT.java
This file contains 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,51 @@ | ||
package io.quarkus.maven.it; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Enumeration; | ||
import java.util.List; | ||
import java.util.jar.JarEntry; | ||
import java.util.jar.JarFile; | ||
|
||
import org.apache.maven.shared.invoker.MavenInvocationException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.maven.it.verifier.MavenProcessInvocationResult; | ||
import io.quarkus.maven.it.verifier.RunningInvoker; | ||
|
||
@DisableForNative | ||
public class IgnoreEntriesIT extends MojoTestBase { | ||
|
||
@Test | ||
public void testIgnoreEntries() | ||
throws MavenInvocationException, IOException, InterruptedException { | ||
File testDir = initProject("projects/ignore-entries-uber-jar"); | ||
|
||
RunningInvoker running = new RunningInvoker(testDir, false); | ||
MavenProcessInvocationResult result = running.execute(Arrays.asList("compile", "quarkus:build"), | ||
Collections.emptyMap()); | ||
assertThat(result.getProcess().waitFor()).isEqualTo(0); | ||
|
||
final File targetDir = new File(testDir, "target"); | ||
List<File> jars = getFilesEndingWith(targetDir, ".jar"); | ||
assertThat(jars).hasSize(1); | ||
assertThat(jars.get(0)).isFile(); | ||
assertThat(jarContains(jars.get(0), "META-INF/swagger-ui-files/swagger-ui-bundle.js.map")).isFalse(); | ||
} | ||
|
||
private boolean jarContains(File jar, String name) throws IOException { | ||
try (JarFile z = new JarFile(jar)) { | ||
for (Enumeration<JarEntry> en = z.entries(); en.hasMoreElements();) { | ||
String fileName = en.nextElement().getName(); | ||
if (name.equalsIgnoreCase(fileName)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains 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
63 changes: 63 additions & 0 deletions
63
integration-tests/maven/src/test/resources/projects/ignore-entries-uber-jar/pom.xml
This file contains 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,63 @@ | ||
<?xml version="1.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" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.acme</groupId> | ||
<artifactId>acme</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<properties> | ||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> | ||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.version>@project.version@</quarkus.platform.version> | ||
<quarkus-plugin.version>@project.version@</quarkus-plugin.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<!-- insert managed dependencies here --> | ||
<dependency> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>${quarkus.platform.artifact-id}</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<!-- insert test dependencies here --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-swagger-ui</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>${quarkus-plugin.version}</version> | ||
<configuration> | ||
<uberJar>true</uberJar> | ||
<ignoredEntries> | ||
<ignoredEntry>META-INF/swagger-ui-files/swagger-ui-bundle.js.map</ignoredEntry> | ||
<ignoredEntry>META-INF/swagger-ui-files/swagger-ui-standalone-preset.js.map</ignoredEntry> | ||
</ignoredEntries> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
17 changes: 17 additions & 0 deletions
17
...test/resources/projects/ignore-entries-uber-jar/src/main/java/org/acme/HelloResource.java
This file contains 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,17 @@ | ||
package org.acme; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class HelloResource { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello"; | ||
} | ||
|
||
} |
Oops, something went wrong.