Śhāhēēd
Śhāhēēd

Reputation: 1882

Why maven deployment extension wagon-ftp not working?

Here is the summery of maven project

mvn -v

Apache Maven 3.3.3 (79941 ... d4a06; 2015-04-22T17:57:37+06:00)
Maven home:  /path/to/apache-maven-3.3.3
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: /path/to/java/jdk1.7.0_67/jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

and pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <artifactId>chorke-base-parent</artifactId>
    <groupId>com.chorke.base</groupId>
    <version>1.0.00-SNAPSHOT</version>
    <name>chorke-base-parent</name>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.4.RELEASE</version>
        <relativePath />
    </parent>

    <properties>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>EEE, MMM dd yyyy, HH:mm Z</maven.build.timestamp.format>
    </properties>

    <distributionManagement>
        <repository>
            <id>releases.ftp</id>
            <url>ftp://127.0.0.1/maven2/releases</url>
        </repository>
        <snapshotRepository>
            <id>snapshots.ftp</id>
            <url>ftp://127.0.0.1/maven2/snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>chorke-comn-parent</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <excludes>
                            <exclude>**/*.md</exclude>
                            <exclude>**/*.groovy</exclude>
                            <exclude>**/.gitkeep</exclude>
                            <exclude>**/.gitignore</exclude>
                        </excludes>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.4</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
        </plugins>

        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ftp</artifactId>
                <version>2.4</version>
            </extension>
        </extensions>
    </build>

    <repositories>
        <repository>
            <id>snapshots</id>
            <url>http://127.0.0.1/maven2/snapshots</url>
            <snapshots><enabled>true</enabled><updatePolicy>interval:240</updatePolicy></snapshots>
            <releases><enabled>false</enabled><updatePolicy>never</updatePolicy></releases>
        </repository>
        <repository>
            <id>releases</id>
            <url>http://127.0.0.1/maven2/releases</url>
            <snapshots><enabled>false</enabled><updatePolicy>never</updatePolicy></snapshots>
            <releases><enabled>true</enabled><updatePolicy>daily</updatePolicy></releases>
        </repository>
    </repositories>

</project>

while settings.xml

<settings 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/settings-1.0.0.xsd">

  <localRepository>/path/to/local/repo</localRepository>
  <servers>
    <server>
        <id>releases</id>
        <configuration>
            <httpHeaders>
                <property>
                    <name>Authorization</name>
                    <value>Basic bWF2ZW46cGFzc3dvcmQ==</value>
                </property>
            </httpHeaders>
        </configuration>
    </server>
    <server>
        <id>snapshots</id>
        <configuration>
            <httpHeaders>
                <property>
                    <name>Authorization</name>
                    <value>Basic bWF2ZW46cGFzc3dvcmQ==</value>
                </property>
            </httpHeaders>
        </configuration>
    </server>
    <server>
        <id>releases.ftp</id>
        <username>maven</username>
        <password>password</password>
    </server>
    <server>
        <id>snapshots.ftp</id>
        <username>maven</username>
        <password>password</password>
    </server>
  </servers>
</settings>

this project succesfully perform mvn clean install deploy -N with jdk1.6.0_## and mvn clean install -N peform with jdk1.7.0_##. while I append deploy for jdk1.7.0_## for example: mvn clean install deploy -N it generate following strack:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project chorke-base-parent: Failed to retrieve remote metadata com.chorke.base:chorke-base-parent:2.0.00-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.chorke.base:chorke-base-parent:2.0.00-SNAPSHOT/maven-metadata.xml from/to snapshots.ftp (ftp://127.0.0.1/maven2/snapshots): Error transferring file via FTP: Connection reset -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project chorke-base-parent: Failed to retrieve remote metadata com.chorke.base:chorke-base-parent:2.0.00-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.chorke.base:chorke-base-parent:2.0.00-SNAPSHOT/maven-metadata.xml from/to snapshots.ftp (ftp://127.0.0.1/maven2/snapshots): Error transferring file via FTP

Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:196)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
    at java.io.InputStreamReader.read(InputStreamReader.java:184)
    at java.io.BufferedReader.fill(BufferedReader.java:154)
    at java.io.BufferedReader.read(BufferedReader.java:175)
    ... more

Would you please help me to configure wagon-ftp perfectly for spring-boot child module with jdk1.7.0_## or greater?

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.4.RELEASE</version>
    <relativePath />
</parent>

Upvotes: 0

Views: 1675

Answers (1)

Śhāhēēd
Śhāhēēd

Reputation: 1882

Actually this problem occurred by me due to IPv6 used by Java 7. This problem resolved by simply put the options in _JAVA_OPTIONS environment variable. For example, on Linux, put the following in your ~/.profile or ~/.bash_profile:

export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"

Thanks a lots to Gimby for his guide line to resolve the issue.

Upvotes: 0

Related Questions