How can I upload my new maven compiled binary to a specific host?

A built a .pom project with my Netbeans 7.3.

Following the guide in

http://www.petrikainulainen.net/programming/tips-and-tricks/creating-a-runnable-binary-distribution-with-maven-assembly-plugin/

I have enriched my compilation by creating a zip file with scripts and run libraries inside.

The next step is to download this zip file to a specific host. Is it possible? How?

This is my 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>xxxx</groupId>
  <artifactId>StormWithKafkaSpout</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>StormWithKafkaSpout</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>

      <dependency>
          <artifactId>storm-core</artifactId>
          <groupId>org.apache.storm</groupId>
          <version>0.9.2-incubating</version>
      </dependency>      

      <!-- Dipendenze legate a Storm -->      
      <dependency>
          <groupId>org.clojure</groupId>
          <artifactId>clojure</artifactId>
          <version>1.5.1</version>
      </dependency>
      <dependency>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
          <version>2.4</version>
      </dependency>
      <dependency>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-exec</artifactId>
          <version>1.1</version>
      </dependency>
      <dependency>
          <groupId>commons-lang</groupId>
          <artifactId>commons-lang</artifactId>
          <version>2.5</version>
      </dependency>
      <dependency>
          <groupId>clj-time</groupId>
          <artifactId>clj-time</artifactId>
          <version>0.4.1</version>
      </dependency>
      <dependency>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
          <version>3.4.6</version>
          <exclusions>
              <exclusion>
                  <groupId>com.sun.jmx</groupId>
                  <artifactId>jmxri</artifactId>
              </exclusion>
              <exclusion>
                  <groupId>com.sun.jdmk</groupId>
                  <artifactId>jmxtools</artifactId>
              </exclusion>
              <exclusion>
                  <groupId>javax.jms</groupId>
                  <artifactId>jms</artifactId>
             </exclusion>
              <exclusion>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
              </exclusion>
              <exclusion>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
          </exclusions>
      </dependency>
      <dependency>
          <groupId>org.apache.curator</groupId>
          <artifactId>curator-framework</artifactId>
          <version>2.5.0</version>
          <exclusions>
              <exclusion>
                  <groupId>log4j</groupId>
                  <artifactId>log4j</artifactId>
              </exclusion>
              <exclusion>
                  <groupId>org.jboss.netty</groupId>
                  <artifactId>netty</artifactId>
              </exclusion>
          </exclusions>
      </dependency>
      <dependency>
          <groupId>com.googlecode.json-simple</groupId>
          <artifactId>json-simple</artifactId>
          <version>1.1</version>
      </dependency>
      <dependency>
          <groupId>compojure</groupId>
          <artifactId>compojure</artifactId>
          <version>1.1.3</version>
      </dependency>
      <dependency>
          <groupId>hiccup</groupId>
          <artifactId>hiccup</artifactId>
          <version>0.3.6</version>
      </dependency>
      <dependency>
          <groupId>ring</groupId>
          <artifactId>ring-devel</artifactId>
          <version>0.3.11</version>
      </dependency>
      <dependency>
          <groupId>ring</groupId>
          <artifactId>ring-jetty-adapter</artifactId>
          <version>0.3.11</version>
      </dependency>
      <dependency>
          <groupId>org.clojure</groupId>
          <artifactId>tools.logging</artifactId>
          <version>0.2.3</version>
      </dependency>
      <dependency>
          <groupId>org.clojure</groupId>
          <artifactId>math.numeric-tower</artifactId>
          <version>0.0.1</version>
      </dependency>
      <dependency>
          <groupId>com.twitter</groupId>
          <artifactId>carbonite</artifactId>
          <version>1.4.0</version>
      </dependency>
      <dependency>
          <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.11</version>
      </dependency>
      <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.3.3</version>
        </dependency>
        <dependency>
            <groupId>org.clojure</groupId>
            <artifactId>tools.cli</artifactId>
            <version>0.2.4</version>
        </dependency>
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.jgrapht</groupId>
            <artifactId>jgrapht-core</artifactId>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>16.0.1</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.0.6</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>1.6.6</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
            <version>3.9.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.clojure</groupId>
            <artifactId>tools.nrepl</artifactId>
            <version>0.2.3</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>clojure</artifactId>
                    <groupId>org.clojure</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>clojure-complete</groupId>
            <artifactId>clojure-complete</artifactId>
            <version>0.2.3</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>clojure</artifactId>
                    <groupId>org.clojure</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.clojars.runa</groupId>
            <artifactId>conjure</artifactId>
            <version>2.1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.thrift</groupId>
            <artifactId>libthrift</artifactId>
            <version>0.7.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- END OF dipendenze legate e Storm -->      

        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.10</artifactId>
            <version>0.8.1.1</version>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
      </dependency>

      <dependency>
          <groupId>org.tomdz.storm</groupId>
          <artifactId>storm-esper</artifactId>
          <version>0.8.1-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>storm</groupId>
                    <artifactId>storm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.espertech</groupId>
                    <artifactId>esper</artifactId>
                </exclusion>
            </exclusions>
         <type>jar</type>
      </dependency>
      <dependency>
          <groupId>com.espertech</groupId>
          <artifactId>esper</artifactId>
          <version>4.11.0</version>
      </dependency>      
      <dependency>
          <groupId>commons-collections</groupId>
          <artifactId>commons-collections</artifactId>
          <version>3.2.1</version>
      </dependency>
      <dependency>
          <groupId>org.clojars.miguno.nl.minvenj.nfi.storm</groupId>
          <artifactId>kafka-spout</artifactId>
          <version>0.2-SNAPSHOT_LATEST</version>
      </dependency>

  </dependencies>

  <repositories>
      <repository>
          <id>clojars</id>
          <url>http://clojars.org/repo/</url>
      </repository>
  </repositories>

  <build>  

      <extensions>
          <!-- Enabling the use of FTP -->
          <extension>
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-ssh</artifactId>
              <version>2.6</version>
          </extension>
      </extensions>

      <plugins>
          <!--
           Bind the maven-assembly-plugin to the package phase
           this will create a jar file without the storm dependencies
           suitable for deployment to a cluster.
          -->
          <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <configuration>
<!--                  <descriptorRefs>
                      <descriptorRef>jar-with-dependencies</descriptorRef>
                  </descriptorRefs>-->
                  <archive>
                      <manifest>
                          <mainClass />
                      </manifest>
                  </archive>
                  <descriptors>
                      <descriptor>src/main/assembly/assembly.xml</descriptor>
                  </descriptors>
              </configuration>
              <executions>
                  <execution>
                      <id>make-assembly</id>
                      <phase>package</phase>
                      <goals>
                          <goal>single</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>

          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-jar-plugin</artifactId>
              <version>2.3.1</version>
              <!-- The configuration of the plugin -->
              <configuration>
                  <!-- Configuration of the archiver -->
                  <archive>
                      <!-- Manifest specific configuration -->
                      <manifest>
                          <!-- Classpath is added to the manifest of the created jar file. -->
                          <addClasspath>true</addClasspath>
                          <!--
                              Configures the classpath prefix. This configuration option is
                              used to specify that all needed libraries are found under lib/
                              directory.
                          -->
                          <classpathPrefix>lib/</classpathPrefix>
                          <!-- Specifies the main class of the application -->
                          <mainClass>com.selexes.stormwithkafkaspout.App</mainClass>
                      </manifest>
                  </archive>
              </configuration>
          </plugin>          

          <plugin>
              <groupId>com.theoryinpractise</groupId>
              <artifactId>clojure-maven-plugin</artifactId>
              <extensions>true</extensions>
              <configuration>
                  <sourceDirectories>
                      <sourceDirectory>src/clj</sourceDirectory>
                  </sourceDirectories>
              </configuration>
              <executions>
                  <execution>
                      <id>compile</id>
                      <phase>compile</phase>
                      <goals>
                          <goal>compile</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>

          <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.2.1</version>
              <executions>
                  <execution>
                      <goals>
                          <goal>exec</goal>
                      </goals>
                  </execution>
              </executions>
              <configuration>
                  <executable>java</executable>
                  <includeProjectDependencies>true</includeProjectDependencies>
                  <includePluginDependencies>false</includePluginDependencies>
                  <classpathScope>compile</classpathScope>
                  <mainClass>${storm.topology}</mainClass>
              </configuration>
          </plugin>
      </plugins>

  </build>
</project>

      

and this is my assembly.xml

<assembly>
<id>bin</id>
<!-- Generates a zip package containing the needed files -->
<formats>
    <format>zip</format>
</formats>
<!-- Adds dependencies to zip package under lib directory -->
<dependencySets>
    <dependencySet>
        <!--
            Project artifact is not copied under library directory since
            it is added to the root directory of the zip package.
        -->
        <useProjectArtifact>false</useProjectArtifact>
        <outputDirectory>lib</outputDirectory>
        <unpack>false</unpack>
    </dependencySet>
</dependencySets>

<fileSets>
    <!--
        Adds startup scripts to the root directory of zip package. The startup
        scripts are located to src/main/scripts directory as stated by Maven
        conventions.
    -->
    <fileSet>
        <directory>${project.build.scriptSourceDirectory}</directory>
        <outputDirectory></outputDirectory>
        <includes>
            <include>startDemo.*</include>
        </includes>
    </fileSet>
    <!-- adds jar package to the root directory of zip package -->
    <fileSet>
        <directory>${project.build.directory}</directory>
        <outputDirectory></outputDirectory>
        <includes>
            <include>*.jar</include>
        </includes>
    </fileSet>
</fileSets>

      

I had a distributionManagement section in my pom, but I don't know exactly how to use it. Here's my setup.xml parameter

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>stormPC</id>
      <username>stormuser</username>
<!--    ???  <privateKey>~/.ssh/id_dsa</privateKey> --> 
      <passphrase>password</passphrase>
    </server>
  </servers>
</settings>

      

and my Distributionmanagement part in my pom.xml

  <distributionManagement>
<repository>
  <id>stormPC</id>
  <name>stormPC</name>
  <url>scp://IP/home/stormuser</url>
</repository>

      

But it doesn't work and I don't know why. Maybe the "name" in the Management distribution should be the name of the remote host?

Thanks everyone.

+3


source to share


1 answer


You need to define a section <distributionManagement/>

in pom.xml

, and then you need to have a corresponding <server>

section in settings.xml

, corresponding to the <id/>

server in yours <distributionManagement/>

.

Consider the following addition to yours pom.xml

:

<distributionManagement>
    <repository>
        <id>my-release-repository</id>
        <url>scp://myrepositry/my-release-repository</url>
    </repository>
    <snapshotRepository>
        <id>my-snapshots-repository</id>
        <url>scp://myrepositry/my-snapshots-repository</url>
    </snapshotRepository>
</distributionManagement>

      



Then in yours, settings.xml

you'll need something along these lines:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>my-release-repository</id>
            <username>your-username</username>
            <password>your-password</password>
        </server>
        <server>
            <id>my-snapshots-repository</id>
            <username>your-username</username>
            <password>your-password</password>
        </server>
    </servers>
</settings>

      

+3


source







All Articles