Skip to content

Commit 7cd9938

Browse files
committed
jooby:run use file.pathSeparator
1 parent c03fc5c commit 7cd9938

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

jooby-maven-plugin/src/main/java/org/jooby/JoobyMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public void execute() throws MojoExecutionException, MojoFailureException {
155155
// includes/excludes pattern
156156
String includes = null;
157157
if (this.includes != null && this.includes.size() > 0) {
158-
includes = this.includes.stream().collect(Collectors.joining(":"));
158+
includes = this.includes.stream().collect(Collectors.joining(File.pathSeparator));
159159
}
160160
String excludes = null;
161161
if (this.excludes != null && this.excludes.size() > 0) {
162-
excludes = this.excludes.stream().collect(Collectors.joining(":"));
162+
excludes = this.excludes.stream().collect(Collectors.joining(File.pathSeparator));
163163
}
164164
// moduleId
165165
String mId = mavenProject.getGroupId() + "." + mavenProject.getArtifactId();

jooby-maven-plugin/src/main/java/org/jooby/RunForkedApp.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ public class RunForkedApp implements Command {
4040
private String mainClass;
4141

4242
public RunForkedApp(final File basedir, final String debug, final List<String> vmArgs,
43-
final Set<File> cp,
44-
final String mId, final String mainClass, final Set<File> appcp, final String includes,
45-
final String excludes) throws MojoFailureException {
43+
final Set<File> cp, final String mId, final String mainClass, final Set<File> appcp,
44+
final String includes, final String excludes) throws MojoFailureException {
4645
this.basedir = basedir;
4746
List<String> args = new ArrayList<String>();
4847
args.addAll(vmArgs(debug, vmArgs));
@@ -52,7 +51,8 @@ public RunForkedApp(final File basedir, final String debug, final List<String> v
5251
args.add(Main.class.getName());
5352
args.add(mId);
5453
args.add(mainClass);
55-
args.add(appcp.stream().map(File::getAbsolutePath).collect(Collectors.joining(":", "deps=", ""))
54+
args.add(appcp.stream().map(File::getAbsolutePath)
55+
.collect(Collectors.joining(File.pathSeparator, "deps=", ""))
5656
.trim());
5757
if (includes != null) {
5858
args.add("includes=" + includes);

jooby-run/src/main/java/org/jooby/run/Main.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ public Main(final String mId, final String mainClass, final File... cp)
7777
this.mId = ModuleIdentifier.create(mId);
7878
this.executor = Executors.newSingleThreadExecutor(task -> new Thread(task, "HotSwap"));
7979
this.scanner = new Watcher(this::onChange, new Path[]{basedir.toPath() });
80-
includes("**/*.class,**/*.conf,**/*.properties,*.js, src/*.js");
80+
includes("**/*.class" + File.pathSeparator + "**/*.conf" + File.pathSeparator
81+
+ "**/*.properties" + File.pathSeparator + "*.js" + File.pathSeparator + "src/*.js");
8182
excludes("");
8283
}
8384

8485
public static void main(final String[] args) throws Exception {
8586
List<File> cp = new ArrayList<File>();
86-
String includes = "**/*.class,**/*.conf,**/*.properties,*.js, src/*.js";
87-
String excludes = "";
87+
String includes = null;
88+
String excludes = null;
8889
for (int i = 2; i < args.length; i++) {
8990
String[] option = args[i].split("=");
9091
if (option.length < 2) {
@@ -102,7 +103,7 @@ public static void main(final String[] args) throws Exception {
102103
setSystemProperties(new File(option[1]));
103104
break;
104105
case "deps":
105-
String[] deps = option[1].split(":");
106+
String[] deps = option[1].split(File.pathSeparator);
106107
for (String dep : deps) {
107108
cp.add(new File(dep));
108109
}
@@ -118,9 +119,13 @@ public static void main(final String[] args) throws Exception {
118119
cp.add(new File(System.getProperty("user.dir")));
119120
}
120121

121-
Main launcher = new Main(args[0], args[1], cp.toArray(new File[cp.size()]))
122-
.includes(includes)
123-
.excludes(excludes);
122+
Main launcher = new Main(args[0], args[1], cp.toArray(new File[cp.size()]));
123+
if (includes != null) {
124+
launcher.includes(includes);
125+
}
126+
if (excludes != null) {
127+
launcher.excludes(excludes);
128+
}
124129
launcher.run();
125130
}
126131

@@ -248,7 +253,7 @@ private Path relativePath(final Path path) {
248253

249254
private static PathMatcher pathMatcher(final String expressions) {
250255
List<PathMatcher> matchers = new ArrayList<PathMatcher>();
251-
for (String expression : expressions.split(",")) {
256+
for (String expression : expressions.split(File.pathSeparator)) {
252257
matchers.add(FileSystems.getDefault().getPathMatcher("glob:" + expression.trim()));
253258
}
254259
return new PathMatcher() {

0 commit comments

Comments
 (0)