Pass compile and source path to showgui.
1.1 --- a/cmdline/maven/src/main/java/org/netbeans/modules/jackpot30/maven/RunJackpot30.java Sat Jan 12 00:01:25 2013 +0100
1.2 +++ b/cmdline/maven/src/main/java/org/netbeans/modules/jackpot30/maven/RunJackpot30.java Sun Jan 13 00:16:50 2013 +0100
1.3 @@ -41,6 +41,8 @@
1.4 import java.io.File;
1.5 import java.io.IOException;
1.6 import java.util.ArrayList;
1.7 +import java.util.Arrays;
1.8 +import java.util.Collections;
1.9 import java.util.List;
1.10 import org.apache.maven.artifact.DependencyResolutionRequiredException;
1.11 import org.apache.maven.model.Resource;
1.12 @@ -55,11 +57,6 @@
1.13
1.14 protected final void doRun(MavenProject project, boolean apply) throws MojoExecutionException, MojoFailureException {
1.15 try {
1.16 - List<String> compileSourceRoots = new ArrayList<String>();
1.17 - compileSourceRoots.addAll((List<String>) project.getCompileSourceRoots());
1.18 - for (Resource r : (List<Resource>) project.getResources()) {
1.19 - compileSourceRoots.add(r.getDirectory());
1.20 - }
1.21 String sourceLevel = "1.5";
1.22 Xpp3Dom sourceLevelConfiguration = Utils.getPluginConfiguration(project, "org.apache.maven.plugins", "maven-compiler-plugin");
1.23
1.24 @@ -80,10 +77,7 @@
1.25 else
1.26 cmdLine.add("--no-apply");
1.27
1.28 - cmdLine.add("--sourcepath");
1.29 - cmdLine.add(toClassPathString(compileSourceRoots));
1.30 - cmdLine.add("--classpath");
1.31 - cmdLine.add(toClassPathString((List<String>) project.getCompileClasspathElements()));
1.32 + cmdLine.addAll(sourceAndCompileClassPaths(Collections.singletonList(project)));
1.33 cmdLine.add("--source");
1.34 cmdLine.add(sourceLevel);
1.35
1.36 @@ -127,4 +121,24 @@
1.37 return classPath.toString();
1.38 }
1.39
1.40 + @SuppressWarnings("unchecked")
1.41 + public static List<String> sourceAndCompileClassPaths(Iterable<? extends MavenProject> projects) throws DependencyResolutionRequiredException {
1.42 + List<String> compileSourceRoots = new ArrayList<String>();
1.43 + List<String> compileClassPath = new ArrayList<String>();
1.44 +
1.45 + for (MavenProject project : projects) {
1.46 + compileSourceRoots.addAll((List<String>) project.getCompileSourceRoots());
1.47 +
1.48 + for (Resource r : (List<Resource>) project.getResources()) {
1.49 + compileSourceRoots.add(r.getDirectory());
1.50 + }
1.51 +
1.52 + compileClassPath.addAll((List<String>) project.getCompileClasspathElements());
1.53 + }
1.54 +
1.55 + return Arrays.asList("--sourcepath",
1.56 + toClassPathString(compileSourceRoots),
1.57 + "--classpath",
1.58 + toClassPathString(compileClassPath));
1.59 + }
1.60 }
2.1 --- a/cmdline/maven/src/main/java/org/netbeans/modules/jackpot30/maven/ShowGuiJackpot30.java Sat Jan 12 00:01:25 2013 +0100
2.2 +++ b/cmdline/maven/src/main/java/org/netbeans/modules/jackpot30/maven/ShowGuiJackpot30.java Sun Jan 13 00:16:50 2013 +0100
2.3 @@ -41,6 +41,7 @@
2.4 import java.io.IOException;
2.5 import java.util.ArrayList;
2.6 import java.util.List;
2.7 +import org.apache.maven.artifact.DependencyResolutionRequiredException;
2.8 import org.apache.maven.plugin.AbstractMojo;
2.9 import org.apache.maven.plugin.MojoExecutionException;
2.10 import org.apache.maven.plugin.MojoFailureException;
2.11 @@ -63,7 +64,7 @@
2.12 public void execute() throws MojoExecutionException, MojoFailureException {
2.13 try {
2.14 if (!project.isExecutionRoot()) return;
2.15 -
2.16 +
2.17 String configurationFile = Utils.getJackpotConfigurationFile(project);
2.18
2.19 if (configurationFile == null)
2.20 @@ -73,13 +74,17 @@
2.21
2.22 cmdLine.add("--config-file");
2.23 cmdLine.add(configurationFile);
2.24 + cmdLine.addAll(RunJackpot30.sourceAndCompileClassPaths(project.getCollectedProjects()));
2.25 cmdLine.add("--show-gui");
2.26 + System.err.println(cmdLine);
2.27
2.28 Main.compile(cmdLine.toArray(new String[0]));
2.29 } catch (IOException ex) {
2.30 throw new MojoExecutionException(ex.getMessage(), ex);
2.31 } catch (ClassNotFoundException ex) {
2.32 throw new MojoExecutionException(ex.getMessage(), ex);
2.33 + } catch (DependencyResolutionRequiredException ex) {
2.34 + throw new MojoExecutionException(ex.getMessage(), ex);
2.35 }
2.36 }
2.37