本文整理汇总了Java中com.intellij.execution.configurations.JavaParameters类的典型用法代码示例。如果您正苦于以下问题:Java JavaParameters类的具体用法?Java JavaParameters怎么用?Java JavaParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaParameters类属于com.intellij.execution.configurations包,在下文中一共展示了JavaParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBinFolder
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
private void addBinFolder(Path tomcatInstallation, JavaParameters javaParams) throws ExecutionException {
// Dynamically adds the tomcat jars to the classpath
Path binFolder = tomcatInstallation.resolve("bin");
if (!Files.exists(binFolder)) {
throw new ExecutionException("The Tomcat installation configured doesn't contains a bin folder");
}
String[] jars = binFolder.toFile().list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".jar");
}
});
for (String jarFile : jars) {
javaParams.getClassPath().add(binFolder.resolve(jarFile).toFile().getAbsolutePath());
}
}
示例2: addLibFolder
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
private void addLibFolder(Path tomcatInstallation, JavaParameters javaParams) throws ExecutionException {
// add libs folder
Path libFolder = tomcatInstallation.resolve("lib");
if (!Files.exists(libFolder)) {
throw new ExecutionException("The Tomcat installation configured doesn't contains a lib folder");
}
String[] jars = libFolder.toFile().list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".jar");
}
});
for (String jarFile : jars) {
javaParams.getClassPath().add(libFolder.resolve(jarFile).toFile().getAbsolutePath());
}
}
示例3: addLivingDocProgramParameterList
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
/**
* <p>To override the default System Under Development class (used for fixture classes instantiation).<br>
* The library with the specified class should be in the same directory as the runner. </p>
* <br>
* <code>-f CLASS;ARGS Use CLASS as the system under development and instantiate it with ARGS</code>
*/
private JavaParameters addLivingDocProgramParameterList() throws ExecutionException {
JavaParameters javaParameters = new JavaParameters();
// Generate XML report (defaults to plain)
javaParameters.getProgramParametersList().add("--xml");
try {
javaParameters.getProgramParametersList().add(getSpecificationInputPath());
javaParameters.getProgramParametersList().add(getReportOutputPath());
} catch (Exception e) {
LOG.error(e);
throw new ExecutionException(e);
}
return javaParameters;
}
示例4: checkTargetJPDAInstalled
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
private static void checkTargetJPDAInstalled(JavaParameters parameters) throws ExecutionException {
final Sdk jdk = parameters.getJdk();
if (jdk == null) {
throw new ExecutionException(DebuggerBundle.message("error.jdk.not.specified"));
}
final JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
String versionString = jdk.getVersionString();
if (version == JavaSdkVersion.JDK_1_0 || version == JavaSdkVersion.JDK_1_1) {
throw new ExecutionException(DebuggerBundle.message("error.unsupported.jdk.version", versionString));
}
if (SystemInfo.isWindows && version == JavaSdkVersion.JDK_1_2) {
final VirtualFile homeDirectory = jdk.getHomeDirectory();
if (homeDirectory == null || !homeDirectory.isValid()) {
throw new ExecutionException(DebuggerBundle.message("error.invalid.jdk.home", versionString));
}
//noinspection HardCodedStringLiteral
File dllFile = new File(
homeDirectory.getPath().replace('/', File.separatorChar) + File.separator + "bin" + File.separator + "jdwp.dll"
);
if (!dllFile.exists()) {
GetJPDADialog dialog = new GetJPDADialog();
dialog.show();
throw new ExecutionException(DebuggerBundle.message("error.debug.libraries.missing"));
}
}
}
示例5: createCommandLineProxy
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
public ProcessProxy createCommandLineProxy(final JavaCommandLine javaCmdLine) throws ExecutionException {
ProcessProxyImpl proxy = null;
final JavaParameters javaParameters = javaCmdLine.getJavaParameters();
String mainClass = javaParameters.getMainClass();
if (ProcessProxyImpl.useLauncher() && mainClass != null) {
try {
proxy = new ProcessProxyImpl();
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
final ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_PORT_NUMBER, String.valueOf(proxy.getPortNumber()));
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_BINPATH, PathManager.getBinPath());
javaParameters.getProgramParametersList().prepend(mainClass);
javaParameters.setMainClass(ProcessProxyImpl.LAUNCH_MAIN_CLASS);
}
catch (ProcessProxyImpl.NoMoreSocketsException e) {
proxy = null;
}
}
return proxy;
}
示例6: passForkMode
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
protected void passForkMode(String forkMode, File tempFile, JavaParameters parameters) throws ExecutionException {
final ParametersList parametersList = parameters.getProgramParametersList();
final List<String> params = parametersList.getParameters();
int paramIdx = params.size() - 1;
for (int i = 0; i < params.size(); i++) {
String param = params.get(i);
if ("-temp".equals(param)) {
paramIdx = i;
break;
}
}
parametersList.addAt(paramIdx, "@@@" + tempFile.getAbsolutePath());
if (getForkSocket() != null) {
parametersList.addAt(paramIdx, ForkedDebuggerHelper.DEBUG_SOCKET + getForkSocket().getLocalPort());
}
}
示例7: createJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createJavaParameters();
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
final DumbService dumbService = DumbService.getInstance(getConfiguration().getProject());
try {
dumbService.setAlternativeResolveEnabled(true);
getClassFilter(data);//check if junit found
}
finally {
dumbService.setAlternativeResolveEnabled(false);
}
createTempFiles(javaParameters);
createServerSocket(javaParameters);
return javaParameters;
}
示例8: createJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createDefaultJavaParameters();
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
RunConfigurationModule module = getConfiguration().getConfigurationModule();
final Project project = module.getProject();
final SourceScope scope = getSourceScope();
final GlobalSearchScope searchScope = scope != null ? scope.getGlobalSearchScope() : GlobalSearchScope.allScope(project);
addClassesListToJavaParameters(myFailedTests, new Function<AbstractTestProxy, String>() {
@Override
public String fun(AbstractTestProxy testInfo) {
return testInfo != null ? getTestPresentation(testInfo, project, searchScope) : null;
}
}, data.getPackageName(), true, javaParameters);
return javaParameters;
}
示例9: isApplicable
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
public static boolean isApplicable(@Nullable Project project, JavaParameters javaParameters, MavenRunConfiguration runConfiguration) {
if (hasResumeFromParameter(runConfiguration)) { // This runConfiguration was created by other MavenResumeAction.
MavenRunConfiguration clonedRunConf = runConfiguration.clone();
List<String> clonedGoals = clonedRunConf.getRunnerParameters().getGoals();
clonedGoals.remove(clonedGoals.size() - 1);
clonedGoals.remove(clonedGoals.size() - 1);
try {
javaParameters = clonedRunConf.createJavaParameters(project);
}
catch (ExecutionException e) {
return false;
}
}
for (String params : javaParameters.getProgramParametersList().getList()) {
if (PARAMS_DISABLING_RESUME.contains(params)) {
return false;
}
}
return true;
}
示例10: assertClasspath
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
private void assertClasspath(String moduleName, Scope scope, Type type, String... expectedPaths) throws Exception {
createOutputDirectories();
PathsList actualPathsList;
Module module = getModule(moduleName);
if (scope == Scope.RUNTIME) {
JavaParameters params = new JavaParameters();
params.configureByModule(module, type == Type.TESTS ? JavaParameters.CLASSES_AND_TESTS : JavaParameters.CLASSES_ONLY);
actualPathsList = params.getClassPath();
}
else {
OrderEnumerator en = OrderEnumerator.orderEntries(module).recursively().withoutSdk().compileOnly();
if (type == Type.PRODUCTION) en.productionOnly();
actualPathsList = en.classes().getPathsList();
}
assertPaths(expectedPaths, actualPathsList.getPathList());
}
示例11: getCommandLine
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
public JavaParameters getCommandLine() {
if (myDone) return myCommandLine;
ParametersList programParameters = myCommandLine.getProgramParametersList();
for (final String property : myExpandedProperties) {
if (property != null) {
programParameters.add(property);
}
}
programParameters.add("-buildfile", myBuildFilePath);
for (final String target : myTargets) {
if (target != null) {
programParameters.add(target);
}
}
myDone = true;
return myCommandLine;
}
示例12: configureCommandLine
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
@Override
public void configureCommandLine(JavaParameters params, @Nullable Module module, boolean tests, VirtualFile script, GroovyScriptRunConfiguration configuration) throws CantRunException {
configureGenericGroovyRunner(params, module, "groovy.ui.GroovyMain", false, tests);
//addClasspathFromRootModel(module, tests, params, true);
params.getVMParametersList().addParametersString(configuration.getVMParameters());
addScriptEncodingSettings(params, script, module);
if (configuration.isDebugEnabled()) {
params.getProgramParametersList().add("--debug");
}
String path = ScriptFileUtil.getLocalFilePath(StringUtil.notNullize(configuration.getScriptPath()));
params.getProgramParametersList().add(FileUtil.toSystemDependentName(path));
params.getProgramParametersList().addParametersString(configuration.getScriptParameters());
}
示例13: updateJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params, RunnerSettings runnerSettings) {
if (!isApplicableFor(configuration)) {
return;
}
final JavaCoverageEnabledConfiguration coverageConfig = JavaCoverageEnabledConfiguration.getFrom(configuration);
//noinspection ConstantConditions
coverageConfig.setCurrentCoverageSuite(null);
final CoverageRunner coverageRunner = coverageConfig.getCoverageRunner();
if (runnerSettings instanceof CoverageRunnerData && coverageRunner != null) {
final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(configuration.getProject());
coverageConfig.setCurrentCoverageSuite(coverageDataManager.addCoverageSuite(coverageConfig));
coverageConfig.appendCoverageArgument(configuration, params);
final Sdk jdk = params.getJdk();
if (jdk != null && JavaSdk.getInstance().isOfVersionOrHigher(jdk, JavaSdkVersion.JDK_1_7) && coverageRunner instanceof JavaCoverageRunner && !((JavaCoverageRunner)coverageRunner).isJdk7Compatible()) {
Notifications.Bus.notify(new Notification("Coverage", "Coverage instrumentation is not fully compatible with JDK 7",
coverageRunner.getPresentableName() +
" coverage instrumentation can lead to java.lang.VerifyError errors with JDK 7. If so, please try IDEA coverage runner.",
NotificationType.WARNING));
}
}
}
示例14: patchParameters
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
@Override
public void patchParameters(
@NotNull JavaParameters parameters, String originalOutputDir, @NotNull GwtFacet gwtFacet) {
final ParametersList programParameters = parameters.getProgramParametersList();
programParameters.add("-server");
programParameters.add("com.google.appengine.tools.development.gwt.AppEngineLauncher");
final CloudSdkService sdkService = CloudSdkService.getInstance();
sdkService.patchJavaParametersForDevServer(parameters.getVMParametersList());
// actually these jars are added by AppEngine dev server automatically. But they need to be
// added to classpath before gwt-dev.jar, because otherwise wrong jsp compiler version will be
// used (see IDEA-63068)
if (sdkService.getLibraries() != null) {
for (File jar :
ArrayUtil.mergeArrays(sdkService.getLibraries(), sdkService.getJspLibraries())) {
parameters.getClassPath().addFirst(FileUtil.toSystemIndependentName(jar.getAbsolutePath()));
}
}
if (sdkService.getToolsApiJarFile() != null) {
parameters.getClassPath().add(sdkService.getToolsApiJarFile());
}
}
示例15: createJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入依赖的package包/类
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters params = new JavaParameters();
final JavaRunConfigurationModule module = myConfiguration.getConfigurationModule();
final String jreHome = myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null;
final int classPathType = JavaParametersUtil.getClasspathType(module,
PageObjectRunConfig.MAIN_CLASS_NAME,
false);
JavaParametersUtil.configureModule(module, params, classPathType, jreHome);
params.setJdk(JavaParametersUtil.createProjectJdk(myConfiguration.getProject(), jreHome));
params.setMainClass(PageObjectRunConfig.MAIN_CLASS_NAME);
params.getProgramParametersList().add(EvaluationConfig.from(myConfiguration).toArgs());
params.getClassPath().add(PathUtil.getJarPathForClass(RunPageObjectMain.class));
params.getClassPath().add(PathUtil.getJarPathForClass(Logger.class));
setupJavaParameters(params);
return params;
}