@Override protected ExitStatus run(OptionSet options) throws Exception { SourceOptions sourceOptions = new SourceOptions(options); List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); GroovyCompilerConfiguration configuration = new OptionSetGroovyCompilerConfiguration( options, this, repositoryConfiguration); if (System.getProperty("grape.root") == null) { System.setProperty("grape.root", "."); } GroovyCompiler groovyCompiler = new GroovyCompiler(configuration); groovyCompiler.compile(sourceOptions.getSourcesArray()); return ExitStatus.OK; }
@Override protected synchronized ExitStatus run(OptionSet options) throws Exception { synchronized (this.monitor) { if (this.runner != null) { throw new RuntimeException( "Already running. Please stop the current application before running another (use the 'stop' command)."); } SourceOptions sourceOptions = new SourceOptions(options); List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); repositoryConfiguration.add(0, new RepositoryConfiguration("local", new File("repository").toURI(), true)); SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter( options, this, repositoryConfiguration); this.runner = new SpringApplicationRunner(configuration, sourceOptions.getSourcesArray(), sourceOptions.getArgsArray()); this.runner.compileAndRun(); return ExitStatus.OK; } }
@Override protected synchronized ExitStatus run(OptionSet options) throws Exception { if (this.runner != null) { throw new RuntimeException( "Already running. Please stop the current application before running another (use the 'stop' command)."); } SourceOptions sourceOptions = new SourceOptions(options); List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); repositoryConfiguration.add(0, new RepositoryConfiguration("local", new File("repository").toURI(), true)); SpringApplicationRunnerConfiguration configuration = new SpringApplicationRunnerConfigurationAdapter( options, this, repositoryConfiguration); this.runner = new SpringApplicationRunner(configuration, sourceOptions.getSourcesArray(), sourceOptions.getArgsArray()); this.runner.compileAndRun(); return ExitStatus.OK; }
@Override protected ExitStatus run(OptionSet options) throws Exception { List<?> nonOptionArguments = new ArrayList<Object>( options.nonOptionArguments()); Assert.isTrue(nonOptionArguments.size() >= 2, "The name of the resulting " + this.type + " and at least one source file must be specified"); File output = new File((String) nonOptionArguments.remove(0)); Assert.isTrue(output.getName().toLowerCase().endsWith("." + this.type), "The output '" + output + "' is not a " + this.type.toUpperCase() + " file."); deleteIfExists(output); GroovyCompiler compiler = createCompiler(options); List<URL> classpath = getClassPathUrls(compiler); List<MatchedResource> classpathEntries = findMatchingClasspathEntries( classpath, options); String[] sources = new SourceOptions(nonOptionArguments).getSourcesArray(); Class<?>[] compiledClasses = compiler.compile(sources); List<URL> dependencies = getClassPathUrls(compiler); dependencies.removeAll(classpath); writeJar(output, compiledClasses, classpathEntries, dependencies); return ExitStatus.OK; }
@Override protected ExitStatus run(OptionSet options) throws Exception { SourceOptions sourceOptions = new SourceOptions(options); TestRunnerConfiguration configuration = new TestRunnerConfigurationAdapter( options, this); this.runner = new TestRunner(configuration, sourceOptions.getSourcesArray(), sourceOptions.getArgsArray()); this.runner.compileAndRunTests(); return ExitStatus.OK.hangup(); }