Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java eclipse maven未找到前缀为';maven组装插件';_Java_Eclipse_Maven_Raspberry Pi_M2eclipse - Fatal编程技术网

Java eclipse maven未找到前缀为';maven组装插件';

Java eclipse maven未找到前缀为';maven组装插件';,java,eclipse,maven,raspberry-pi,m2eclipse,Java,Eclipse,Maven,Raspberry Pi,M2eclipse,我试图在Eclipse Luna环境中使用maven来组装一个可执行jar并将其部署到Raspberry Pi,我找到了一个合适的maven脚本,但maven似乎没有找到它的第一个插件,并声明构建失败请参见下面的控制台日志:- [INFO] Scanning for projects... [INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml [IN

我试图在Eclipse Luna环境中使用maven来组装一个可执行jar并将其部署到Raspberry Pi,我找到了一个合适的maven脚本,但maven似乎没有找到它的第一个插件,并声明构建失败请参见下面的控制台日志:-

[INFO] Scanning for projects...
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 21.6 KB/sec)
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 32.6 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.404 s
[INFO] Finished at: 2016-07-21T20:01:39+01:00
[INFO] Final Memory: 12M/164M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'maven-assembly-plugin' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\GJWood\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
这是我的pom.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>RPITank</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <!-- DEFAULT RASPBERRY PI PROPERTIES -->
    <pi.host>192.168.1.123</pi.host>
    <pi.port>22</pi.port>
    <pi.user>pi</pi.user>
    <pi.password>raspberry</pi.password>
    <pi.deployDirectory>/home/pi/artifacts</pi.deployDirectory>
    <pi.main.class>RPITank</pi.main.class>

</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.pi4j</groupId>
        <artifactId>pi4j-core</artifactId>
        <version>1.1-SNAPSHOT</version>
    </dependency>
</dependencies>

<build>
    <plugins>

        <!-- This plugin will generate JAR MANIFEST file inside the JAR in order to make our application easily runnable -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>${pi.main.class}</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-my-jar-with-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <!--This plugin will Transfer the executable JAR file to the Pi and runs it -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <tasks>
                            <!-- ensure the target directory exists on the Raspberry Pi -->
                            <sshexec host="${pi.host}" port="${pi.port}" username="${pi.user}" password="${pi.password}" 
                                     trust="true" failonerror="false" verbose="true" 
                                     command="mkdir --parents ${pi.deployDirectory}"/>

                            <!-- copy the JAR file to the Raspberry Pi -->
                            <scp
                                file="${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar"
                                todir="${pi.user}:${pi.password}@${pi.host}:${pi.deployDirectory}"
                                port="${pi.port}" trust="true" verbose="true" failonerror="true">
                            </scp> 

                            <!-- run the JAR file on the Raspberry Pi -->
                            <sshexec host="${pi.host}" port="${pi.port}" username="${pi.user}"
                                     password="${pi.password}" trust="true" failonerror="false"
                                     verbose="true" 
                                     command="java -jar ${pi.deployDirectory}/${project.build.finalName}-jar-with-dependencies.jar"/>
                        </tasks>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.apache.ant</groupId>
                    <artifactId>ant-jsch</artifactId>
                    <version>1.9.6</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
</project>
我还尝试了引用引用库中的jar文件


一切都没有用

我的问题最初的目的是将eclipse中的代码部署到Raspberry Pi,现在我已经通过一个简单的“hello world”程序实现了这一点,如下所示:

  • 可能没有必要,但我想我应该从全新安装最新版本的Eclipse(Neon)开始

  • 将pom.xml更新为如下所示

    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building HelloWorld 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-antrun-plugin:1.8:run (ant-copy-execute) @ HelloWorld ---
    [INFO] Executing tasks
    
    main:
      [sshexec] Connecting to 192.168.1.123:22
      [sshexec] Connecting to 192.168.1.123 port 22
      [sshexec] Connection established
      [sshexec] Remote version string: SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u2
      [sshexec] Local version string: SSH-2.0-JSCH-0.1.50
      [sshexec] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      [sshexec] aes256-ctr is not available.
      [sshexec] aes192-ctr is not available.
      [sshexec] aes256-cbc is not available.
      [sshexec] aes192-cbc is not available.
      [sshexec] arcfour256 is not available.
      [sshexec] CheckKexes: diffie-hellman-group14-sha1
      [sshexec] SSH_MSG_KEXINIT sent
      [sshexec] SSH_MSG_KEXINIT received
      [sshexec] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
      [sshexec] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: 
      [sshexec] kex: server: 
      [sshexec] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
      [sshexec] kex: client: ssh-rsa,ssh-dss
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: none
      [sshexec] kex: client: none
      [sshexec] kex: client: 
      [sshexec] kex: client: 
      [sshexec] kex: server->client aes128-ctr hmac-sha1 none
      [sshexec] kex: client->server aes128-ctr hmac-sha1 none
      [sshexec] SSH_MSG_KEXDH_INIT sent
      [sshexec] expecting SSH_MSG_KEXDH_REPLY
      [sshexec] ssh_rsa_verify: signature true
      [sshexec] Permanently added '192.168.1.123' (RSA) to the list of known hosts.
      [sshexec] SSH_MSG_NEWKEYS sent
      [sshexec] SSH_MSG_NEWKEYS received
      [sshexec] SSH_MSG_SERVICE_REQUEST sent
      [sshexec] SSH_MSG_SERVICE_ACCEPT received
      [sshexec] Authentications that can continue: publickey,keyboard-interactive,password
      [sshexec] Next authentication method: publickey
      [sshexec] Authentications that can continue: password
      [sshexec] Next authentication method: password
      [sshexec] Authentication succeeded (password).
      [sshexec] cmd : mkdir --parents /home/pi/artifacts
      [sshexec] Disconnecting from 192.168.1.123 port 22
      [sshexec] Caught an exception, leaving main loop due to Socket closed
          [scp] Connecting to 192.168.1.123:22
          [scp] Connecting to 192.168.1.123 port 22
          [scp] Connection established
          [scp] Remote version string: SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u2
          [scp] Local version string: SSH-2.0-JSCH-0.1.50
          [scp] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
          [scp] aes256-ctr is not available.
          [scp] aes192-ctr is not available.
          [scp] aes256-cbc is not available.
          [scp] aes192-cbc is not available.
          [scp] arcfour256 is not available.
          [scp] CheckKexes: diffie-hellman-group14-sha1
          [scp] SSH_MSG_KEXINIT sent
          [scp] SSH_MSG_KEXINIT received
          [scp] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
          [scp] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
          [scp] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
          [scp] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
          [scp] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
          [scp] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
          [scp] kex: server: none,zlib@openssh.com
          [scp] kex: server: none,zlib@openssh.com
          [scp] kex: server: 
          [scp] kex: server: 
          [scp] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
          [scp] kex: client: ssh-rsa,ssh-dss
          [scp] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
          [scp] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
          [scp] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
          [scp] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
          [scp] kex: client: none
          [scp] kex: client: none
          [scp] kex: client: 
          [scp] kex: client: 
          [scp] kex: server->client aes128-ctr hmac-sha1 none
          [scp] kex: client->server aes128-ctr hmac-sha1 none
          [scp] SSH_MSG_KEXDH_INIT sent
          [scp] expecting SSH_MSG_KEXDH_REPLY
          [scp] ssh_rsa_verify: signature true
          [scp] Permanently added '192.168.1.123' (RSA) to the list of known hosts.
          [scp] SSH_MSG_NEWKEYS sent
          [scp] SSH_MSG_NEWKEYS received
          [scp] SSH_MSG_SERVICE_REQUEST sent
          [scp] SSH_MSG_SERVICE_ACCEPT received
          [scp] Authentications that can continue: publickey,keyboard-interactive,password
          [scp] Next authentication method: publickey
          [scp] Authentications that can continue: password
          [scp] Next authentication method: password
          [scp] Authentication succeeded (password).
          [scp] Sending: HelloWorld-0.0.1-SNAPSHOT.jar : 3278
          [scp] File transfer time: 0.01 Average Rate: 409,750.0 B/s
          [scp] done.
          [scp] Disconnecting from 192.168.1.123 port 22
          [scp] Caught an exception, leaving main loop due to Socket closed
      [sshexec] Connecting to 192.168.1.123:22
      [sshexec] Connecting to 192.168.1.123 port 22
      [sshexec] Connection established
      [sshexec] Remote version string: SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u2
      [sshexec] Local version string: SSH-2.0-JSCH-0.1.50
      [sshexec] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      [sshexec] aes256-ctr is not available.
      [sshexec] aes192-ctr is not available.
      [sshexec] aes256-cbc is not available.
      [sshexec] aes192-cbc is not available.
      [sshexec] arcfour256 is not available.
      [sshexec] CheckKexes: diffie-hellman-group14-sha1
      [sshexec] SSH_MSG_KEXINIT sent
      [sshexec] SSH_MSG_KEXINIT received
      [sshexec] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
      [sshexec] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: 
      [sshexec] kex: server: 
      [sshexec] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
      [sshexec] kex: client: ssh-rsa,ssh-dss
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: none
      [sshexec] kex: client: none
      [sshexec] kex: client: 
      [sshexec] kex: client: 
      [sshexec] kex: server->client aes128-ctr hmac-sha1 none
      [sshexec] kex: client->server aes128-ctr hmac-sha1 none
      [sshexec] SSH_MSG_KEXDH_INIT sent
      [sshexec] expecting SSH_MSG_KEXDH_REPLY
      [sshexec] ssh_rsa_verify: signature true
      [sshexec] Permanently added '192.168.1.123' (RSA) to the list of known hosts.
      [sshexec] SSH_MSG_NEWKEYS sent
      [sshexec] SSH_MSG_NEWKEYS received
      [sshexec] SSH_MSG_SERVICE_REQUEST sent
      [sshexec] SSH_MSG_SERVICE_ACCEPT received
      [sshexec] Authentications that can continue: publickey,keyboard-interactive,password
      [sshexec] Next authentication method: publickey
      [sshexec] Authentications that can continue: password
      [sshexec] Next authentication method: password
      [sshexec] Authentication succeeded (password).
      [sshexec] cmd : java -jar /home/pi/artifacts/HelloWorld-0.0.1-SNAPSHOT.jar
    Hello World
      [sshexec] Disconnecting from 192.168.1.123 port 22
      [sshexec] Caught an exception, leaving main loop due to Socket closed
    [INFO] Executed tasks
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 8.052 s
    [INFO] Finished at: 2016-07-29T15:11:30+01:00
    [INFO] Final Memory: 11M/170M
    [INFO] ------------------------------------------------------------------------
    
    http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 拉德伯里 你好世界 0.0.1-快照 你好世界 简单的

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    
        <!-- DEFAULT RASPBERRY PI PROPERTIES -->
        <pi.host>192.168.1.123</pi.host>
        <pi.port>22</pi.port>
        <pi.user>pi</pi.user>
        <pi.password>raspberry</pi.password>
        <pi.deployDirectory>/home/pi/artifacts</pi.deployDirectory>
        <pi.main.class>org.ladbury.testPkg.HelloWorld</pi.main.class>
    </properties>
    
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
    
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>${pi.main.class}</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
    
            <!--This plugin will transfer the executable JAR file to the Pi and runs 
                it -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>ant-copy-execute</id>
                        <phase>install</phase>
                        <configuration>
    
                            <target>
                                <!-- ensure the target directory exists on the Raspberry Pi -->
                                <sshexec host="${pi.host}" port="${pi.port}" username="${pi.user}"
                                    password="${pi.password}" trust="true" failonerror="false"
                                    verbose="true" command="mkdir --parents ${pi.deployDirectory}" />
    
                                <!-- copy the JAR file to the Raspberry Pi -->
                                <scp file="${project.build.directory}/${project.build.finalName}.jar"
                                    todir="${pi.user}:${pi.password}@${pi.host}:${pi.deployDirectory}"
                                    port="${pi.port}" trust="true" verbose="true" failonerror="true" />
    
    
                                <!-- run the JAR file on the Raspberry Pi -->
                                <sshexec host="${pi.host}" port="${pi.port}" username="${pi.user}"
                                    password="${pi.password}" trust="true" failonerror="false"
                                    verbose="true"
                                    command="java -jar ${pi.deployDirectory}/${project.build.finalName}.jar" />
                            </target>
    
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.ant</groupId>
                        <artifactId>ant-jsch</artifactId>
                        <version>1.9.6</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    

    我的问题最初的目的是将eclipse中的代码部署到Raspberry Pi,现在我已经通过一个简单的“hello world”程序实现了这一点,如下所示:

  • 可能没有必要,但我想我应该从全新安装最新版本的Eclipse(Neon)开始

  • 将pom.xml更新为如下所示

    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building HelloWorld 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-antrun-plugin:1.8:run (ant-copy-execute) @ HelloWorld ---
    [INFO] Executing tasks
    
    main:
      [sshexec] Connecting to 192.168.1.123:22
      [sshexec] Connecting to 192.168.1.123 port 22
      [sshexec] Connection established
      [sshexec] Remote version string: SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u2
      [sshexec] Local version string: SSH-2.0-JSCH-0.1.50
      [sshexec] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      [sshexec] aes256-ctr is not available.
      [sshexec] aes192-ctr is not available.
      [sshexec] aes256-cbc is not available.
      [sshexec] aes192-cbc is not available.
      [sshexec] arcfour256 is not available.
      [sshexec] CheckKexes: diffie-hellman-group14-sha1
      [sshexec] SSH_MSG_KEXINIT sent
      [sshexec] SSH_MSG_KEXINIT received
      [sshexec] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
      [sshexec] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: 
      [sshexec] kex: server: 
      [sshexec] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
      [sshexec] kex: client: ssh-rsa,ssh-dss
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: none
      [sshexec] kex: client: none
      [sshexec] kex: client: 
      [sshexec] kex: client: 
      [sshexec] kex: server->client aes128-ctr hmac-sha1 none
      [sshexec] kex: client->server aes128-ctr hmac-sha1 none
      [sshexec] SSH_MSG_KEXDH_INIT sent
      [sshexec] expecting SSH_MSG_KEXDH_REPLY
      [sshexec] ssh_rsa_verify: signature true
      [sshexec] Permanently added '192.168.1.123' (RSA) to the list of known hosts.
      [sshexec] SSH_MSG_NEWKEYS sent
      [sshexec] SSH_MSG_NEWKEYS received
      [sshexec] SSH_MSG_SERVICE_REQUEST sent
      [sshexec] SSH_MSG_SERVICE_ACCEPT received
      [sshexec] Authentications that can continue: publickey,keyboard-interactive,password
      [sshexec] Next authentication method: publickey
      [sshexec] Authentications that can continue: password
      [sshexec] Next authentication method: password
      [sshexec] Authentication succeeded (password).
      [sshexec] cmd : mkdir --parents /home/pi/artifacts
      [sshexec] Disconnecting from 192.168.1.123 port 22
      [sshexec] Caught an exception, leaving main loop due to Socket closed
          [scp] Connecting to 192.168.1.123:22
          [scp] Connecting to 192.168.1.123 port 22
          [scp] Connection established
          [scp] Remote version string: SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u2
          [scp] Local version string: SSH-2.0-JSCH-0.1.50
          [scp] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
          [scp] aes256-ctr is not available.
          [scp] aes192-ctr is not available.
          [scp] aes256-cbc is not available.
          [scp] aes192-cbc is not available.
          [scp] arcfour256 is not available.
          [scp] CheckKexes: diffie-hellman-group14-sha1
          [scp] SSH_MSG_KEXINIT sent
          [scp] SSH_MSG_KEXINIT received
          [scp] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
          [scp] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
          [scp] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
          [scp] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
          [scp] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
          [scp] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
          [scp] kex: server: none,zlib@openssh.com
          [scp] kex: server: none,zlib@openssh.com
          [scp] kex: server: 
          [scp] kex: server: 
          [scp] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
          [scp] kex: client: ssh-rsa,ssh-dss
          [scp] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
          [scp] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
          [scp] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
          [scp] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
          [scp] kex: client: none
          [scp] kex: client: none
          [scp] kex: client: 
          [scp] kex: client: 
          [scp] kex: server->client aes128-ctr hmac-sha1 none
          [scp] kex: client->server aes128-ctr hmac-sha1 none
          [scp] SSH_MSG_KEXDH_INIT sent
          [scp] expecting SSH_MSG_KEXDH_REPLY
          [scp] ssh_rsa_verify: signature true
          [scp] Permanently added '192.168.1.123' (RSA) to the list of known hosts.
          [scp] SSH_MSG_NEWKEYS sent
          [scp] SSH_MSG_NEWKEYS received
          [scp] SSH_MSG_SERVICE_REQUEST sent
          [scp] SSH_MSG_SERVICE_ACCEPT received
          [scp] Authentications that can continue: publickey,keyboard-interactive,password
          [scp] Next authentication method: publickey
          [scp] Authentications that can continue: password
          [scp] Next authentication method: password
          [scp] Authentication succeeded (password).
          [scp] Sending: HelloWorld-0.0.1-SNAPSHOT.jar : 3278
          [scp] File transfer time: 0.01 Average Rate: 409,750.0 B/s
          [scp] done.
          [scp] Disconnecting from 192.168.1.123 port 22
          [scp] Caught an exception, leaving main loop due to Socket closed
      [sshexec] Connecting to 192.168.1.123:22
      [sshexec] Connecting to 192.168.1.123 port 22
      [sshexec] Connection established
      [sshexec] Remote version string: SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u2
      [sshexec] Local version string: SSH-2.0-JSCH-0.1.50
      [sshexec] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      [sshexec] aes256-ctr is not available.
      [sshexec] aes192-ctr is not available.
      [sshexec] aes256-cbc is not available.
      [sshexec] aes192-cbc is not available.
      [sshexec] arcfour256 is not available.
      [sshexec] CheckKexes: diffie-hellman-group14-sha1
      [sshexec] SSH_MSG_KEXINIT sent
      [sshexec] SSH_MSG_KEXINIT received
      [sshexec] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
      [sshexec] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: none,zlib@openssh.com
      [sshexec] kex: server: 
      [sshexec] kex: server: 
      [sshexec] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
      [sshexec] kex: client: ssh-rsa,ssh-dss
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      [sshexec] kex: client: none
      [sshexec] kex: client: none
      [sshexec] kex: client: 
      [sshexec] kex: client: 
      [sshexec] kex: server->client aes128-ctr hmac-sha1 none
      [sshexec] kex: client->server aes128-ctr hmac-sha1 none
      [sshexec] SSH_MSG_KEXDH_INIT sent
      [sshexec] expecting SSH_MSG_KEXDH_REPLY
      [sshexec] ssh_rsa_verify: signature true
      [sshexec] Permanently added '192.168.1.123' (RSA) to the list of known hosts.
      [sshexec] SSH_MSG_NEWKEYS sent
      [sshexec] SSH_MSG_NEWKEYS received
      [sshexec] SSH_MSG_SERVICE_REQUEST sent
      [sshexec] SSH_MSG_SERVICE_ACCEPT received
      [sshexec] Authentications that can continue: publickey,keyboard-interactive,password
      [sshexec] Next authentication method: publickey
      [sshexec] Authentications that can continue: password
      [sshexec] Next authentication method: password
      [sshexec] Authentication succeeded (password).
      [sshexec] cmd : java -jar /home/pi/artifacts/HelloWorld-0.0.1-SNAPSHOT.jar
    Hello World
      [sshexec] Disconnecting from 192.168.1.123 port 22
      [sshexec] Caught an exception, leaving main loop due to Socket closed
    [INFO] Executed tasks
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 8.052 s
    [INFO] Finished at: 2016-07-29T15:11:30+01:00
    [INFO] Final Memory: 11M/170M
    [INFO] ------------------------------------------------------------------------
    
    http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 拉德伯里 你好世界 0.0.1-快照 你好世界 简单的

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    
        <!-- DEFAULT RASPBERRY PI PROPERTIES -->
        <pi.host>192.168.1.123</pi.host>
        <pi.port>22</pi.port>
        <pi.user>pi</pi.user>
        <pi.password>raspberry</pi.password>
        <pi.deployDirectory>/home/pi/artifacts</pi.deployDirectory>
        <pi.main.class>org.ladbury.testPkg.HelloWorld</pi.main.class>
    </properties>
    
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
    
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>${pi.main.class}</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
    
            <!--This plugin will transfer the executable JAR file to the Pi and runs 
                it -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>ant-copy-execute</id>
                        <phase>install</phase>
                        <configuration>
    
                            <target>
                                <!-- ensure the target directory exists on the Raspberry Pi -->
                                <sshexec host="${pi.host}" port="${pi.port}" username="${pi.user}"
                                    password="${pi.password}" trust="true" failonerror="false"
                                    verbose="true" command="mkdir --parents ${pi.deployDirectory}" />
    
                                <!-- copy the JAR file to the Raspberry Pi -->
                                <scp file="${project.build.directory}/${project.build.finalName}.jar"
                                    todir="${pi.user}:${pi.password}@${pi.host}:${pi.deployDirectory}"
                                    port="${pi.port}" trust="true" verbose="true" failonerror="true" />
    
    
                                <!-- run the JAR file on the Raspberry Pi -->
                                <sshexec host="${pi.host}" port="${pi.port}" username="${pi.user}"
                                    password="${pi.password}" trust="true" failonerror="false"
                                    verbose="true"
                                    command="java -jar ${pi.deployDirectory}/${project.build.finalName}.jar" />
                            </target>
    
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.ant</groupId>
                        <artifactId>ant-jsch</artifactId>
                        <version>1.9.6</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    

    查看您如何调用Maven?从E home访问,因此没有代理问题。Maven通过eclipseTo中的run rightclick m2选项调用要清楚,我是从Eclipse中运行M2Eclipse,而不是从命令行Maven查看您如何调用Maven?从E home访问,因此没有代理问题。Maven通过eclipseTo中的run rightclick m2选项调用请清楚,我是在Eclipse中运行M2Eclipse,而不是在命令行maven中运行