小编Adi*_*tya的帖子

无法从 Gradle 运行 python 脚本?

我尝试过以下代码,但不确定问题是什么

task runPython(type:Exec) {
    workingDir 'C:\\Users\\adityaj\\git\\Learn\\TestProject'
    commandLine 'python', 'main.py'
}
Run Code Online (Sandbox Code Playgroud)

项目层次结构

还附上项目层次结构

下面是我的 build.gradle 文件:

plugins {
    id 'groovy'
    id 'com.gradle.plugin-publish' version '0.9.10'
    id 'eclipse'
}
apply plugin: 'eclipse'
//apply plugin: 'py-build'

repositories { 
    jcenter()
}

dependencies {
  testCompile 'pypi:Werkzeug:0.7'
  testCompile 'pypi:Jinja2:2.4'
  testCompile 'pypi:itsdangerous:0.21'
  testCompile 'pypi:click:2.0'
}

task runPython(type:Exec) {
    workingDir 'C:\\Users\\adityaj\\git\\Learn\\TestProject'
    commandLine 'python', 'main.py'
}
test {
    testLogging {
        events 'skipped', 'failed', 'standard_error'
        exceptionFormat 'full'
    }
}
Run Code Online (Sandbox Code Playgroud)

python gradle python-2.7 python-3.x build.gradle

6
推荐指数
0
解决办法
2214
查看次数

使用JSch连接到远程Windows机器

我想在远程系统上执行命令,并希望获得相同的结果.

我试过以下代码:

package rough;
import java.io.InputStream;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;

public class RemoteSSH {

    public static void main(String[] args) {
        String host = "\\\\10.209.110.114";
        String user = "Administrator";
        String password = "Admin123";
        String command1 = "ipconfig";
        try {
            java.util.Properties config = new java.util.Properties();
            config.put("StrictHostKeyChecking", "no");
            JSch jsch = new JSch();
            Session session = jsch.getSession(user, host, 22);
            session.setPassword(password);
            session.setConfig(config);
            session.connect();
            System.out.println("Connected");

            Channel channel = session.openChannel("exec");
            ((ChannelExec) channel).setCommand(command1);
            channel.setInputStream(null);
            ((ChannelExec) channel).setErrStream(System.err);

            InputStream in = channel.getInputStream();
            channel.connect();
            byte[] tmp …
Run Code Online (Sandbox Code Playgroud)

java jsch

5
推荐指数
1
解决办法
5357
查看次数

如何在詹金斯文件中传递多选择值参数(Groovy)

例如,以下代码用于单个选择值

        choice{
           choices: 'Box\nOneDrive\nSharePointOnline\nGmail\nGDrive\nGenericS3',
           defaultValue: 'box', 
           description:  'Connector to build',
           name: 'On_Cloud_Devices_To_Test'
         }
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-plugins jenkins-pipeline

2
推荐指数
2
解决办法
9430
查看次数