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

[WFMP-232] Add support for bootable JAR #441

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<version.org.jboss.shrinkwrap.shrinkwrap>1.2.6</version.org.jboss.shrinkwrap.shrinkwrap>

<jboss.home>${project.build.directory}${file.separator}wildfly</jboss.home>
<test.class.path>${project.build.testOutputDirectory}</test.class.path>
<test.jvm.args>-Dmaven.repo.local=${settings.localRepository}</test.jvm.args>
</properties>

<licenses>
Expand Down Expand Up @@ -92,6 +94,19 @@
</dependencies>

<build>
<testResources>
<!-- Process default resources -->
<testResource>
<directory>src/test/resources</directory>
<targetPath>${project.build.testOutputDirectory}</targetPath>
</testResource>
<!-- Copy the custom modules to the WildFly module directory -->
<testResource>
<directory>src/test/modules</directory>
<filtering>true</filtering>
<targetPath>${jboss.home}/modules</targetPath>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down Expand Up @@ -119,6 +134,7 @@
<location>wildfly@maven(org.jboss.universe:community-universe)#${version.org.wildfly}</location>
</feature-pack>
</feature-packs>
<record-state>false</record-state>
<install-dir>${project.build.directory}/wildfly</install-dir>
<plugin-options>
<jboss-fork-embedded>${plugin.fork.embedded}</jboss-fork-embedded>
Expand All @@ -127,6 +143,21 @@
</execution>
</executions>
</plugin>
<!-- We need to bind a new execution of this to run after provisioning is done so the module.xml file
required for testing is not deleted.
-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-module</id>
<phase>pre-integration-test</phase>
<goals>
<goal>testResources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
Expand All @@ -141,6 +172,7 @@
<redirectTestOutputToFile>${maven.test.redirectTestOutputToFile}</redirectTestOutputToFile>
<systemPropertyVariables>
<jboss.home>${jboss.home}</jboss.home>
<test.jvm.args>${test.jvm.args}</test.jvm.args>
</systemPropertyVariables>
</configuration>
<executions>
Expand Down
25 changes: 25 additions & 0 deletions core/src/main/java/org/wildfly/plugin/core/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,42 @@

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
*
* @author [email protected]
*/
public class Utils {
private static final Pattern WHITESPACE_IF_NOT_QUOTED = Pattern.compile("(\\S+\"[^\"]+\")|\\S+");

public static boolean isValidHomeDirectory(final Path path) {
return path != null
&& Files.exists(path)
&& Files.isDirectory(path)
&& Files.exists(path.resolve("jboss-modules.jar"));
}

/**
* Splits the arguments into a list. The arguments are split based on
* whitespace while ignoring whitespace that is within quotes.
*
* @param arguments the arguments to split
*
* @return the list of the arguments
*/
public static List<String> splitArguments(final CharSequence arguments) {
final List<String> args = new ArrayList<>();
final Matcher m = WHITESPACE_IF_NOT_QUOTED.matcher(arguments);
while (m.find()) {
final String value = m.group();
if (!value.isEmpty()) {
args.add(value);
}
}
return args;
}
}
Loading