2015-05-06 18 views
10

Bir masaüstüm (centos 7.1) ve bir ftp sunucum var (GF4 burada). Ve ben Ancak bu olsun (cadı Nautilus tarafından monte edilmiş) ftp sunucusuna binayı maven sonra dosyaları kopyalamak istiyorum:Maven: FTP'ye kopyalanıyor java.io.IOException: Yasadışı arama

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:497) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying artifact from /home/myuser/temp/target/temp.jar to /run/user/1000/gvfs/ftp:host=X.X.X.X,port=XXX/glassfish4/glassfish/domains/domain3/autodeploy/bundles/temp.jar 
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:232) 
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.copyArtifact(CopyMojo.java:133) 
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.doExecute(CopyMojo.java:111) 
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:167) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    ... 19 more 
Caused by: java.io.IOException: Illegal seek 
    at sun.nio.ch.FileDispatcherImpl.pwrite0(Native Method) 
    at sun.nio.ch.FileDispatcherImpl.pwrite(FileDispatcherImpl.java:66) 
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:89) 
    at sun.nio.ch.IOUtil.write(IOUtil.java:51) 
    at sun.nio.ch.FileChannelImpl.writeInternal(FileChannelImpl.java:745) 
    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:731) 
    at sun.nio.ch.FileChannelImpl.transferFromFileChannel(FileChannelImpl.java:603) 
    at sun.nio.ch.FileChannelImpl.transferFrom(FileChannelImpl.java:675) 
    at org.codehaus.plexus.util.FileUtils.doCopyFile(FileUtils.java:1077) 
    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1049) 
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:228) 
    ... 24 more 

/user/1000/gvfs/ftp çalıştırmak klasörde dosya /: XXXX host =, port = XXX/glassfish4/glassfish/domain/domain3/autodeploy/bundles/temp.jar oluşturuldu ancak boyutu = 0. Ayrıca el ile kopyaladığımda: her şey yolunda değil. Nasıl düzeltilir?
EDIT1
Sadece etkinleştiriciyi içeren boş bir proje oluşturdum. Hedef klasör hworld-1.0.-SNAPSHOT.jar oluşturulur ancak boyutu = 0 - İşte pom

<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.mycompany</groupId> 
    <artifactId>hworld</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>bundle</packaging> 

    <name>hworld</name> 

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

    <dependencies> 
     <dependency> 
      <groupId>org.osgi</groupId> 
      <artifactId>org.osgi.core</artifactId> 
      <version>4.3.0</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.felix</groupId> 
       <artifactId>maven-bundle-plugin</artifactId> 
       <version>2.3.7</version> 
       <extensions>true</extensions> 
       <configuration> 
        <instructions> 
         <Bundle-Activator>com.mycompany.hworld.Activator</Bundle-Activator> 
         <Export-Package/> 
        </instructions> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.8</version> 
       <executions> 
        <execution> 
        <id>copy</id> 
        <phase>package</phase> 
        <goals> 
         <goal>copy</goal> 
        </goals> 
        <configuration> 
         <artifactItems> 
         <artifactItem> 
          <groupId>${project.groupId}</groupId> 
          <artifactId>${project.artifactId}</artifactId> 
          <version>${project.version}</version> 
          <type>${project.packaging}</type> 
          <outputDirectory>HERE IS FOLDER NAME</outputDirectory> 
         </artifactItem> 
         </artifactItems> 
        </configuration> 
        </execution> 
       </executions> 
       </plugin>    
     </plugins> 
    </build> 

    <profiles> 
     <profile> 
      <id>build-for-felix</id> 
      <dependencies> 
       <dependency> 
        <groupId>org.apache.felix</groupId> 
        <artifactId>org.apache.felix.main</artifactId> 
        <version>4.0.3</version> 
        <scope>provided</scope> 
       </dependency> 
       </dependencies> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-antrun-plugin</artifactId> 
         <version>1.7</version> 
         <executions> 
          <execution> 
           <id>compile</id> 
           <phase>package</phase> 
           <goals> 
            <goal>run</goal> 
           </goals> 
           <configuration> 
            <target> 
             <pathconvert property="plugins.jars" pathsep="${path.separator}"> 
              <path refid="maven.runtime.classpath"/> 
              <map from="${project.build.directory}${file.separator}classes" to=""/> 
             </pathconvert> 
             <pathconvert pathsep=" " property="bundles"> 
              <path path="${plugins.jars}"/> 
              <mapper> 
               <chainedmapper> 
                <flattenmapper/> 
                <globmapper from="*" to="file:modules/*" casesensitive="no"/> 
               </chainedmapper> 
              </mapper> 
             </pathconvert> 
             <propertyfile file="${project.build.directory}/config.properties"> 
              <entry key="felix.auto.start" value="${bundles} file:modules/${project.build.finalName}.jar"/> 
              <entry key="org.osgi.framework.bootdelegation" value="*"/> 
             </propertyfile> 
             <copy file="${maven.dependency.org.apache.felix.org.apache.felix.main.jar.path}" tofile="${project.build.directory}/felix.jar"/> 
            </target> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-assembly-plugin</artifactId> 
         <version>2.3</version> 
         <executions> 
          <execution> 
           <id>create-executable-jar</id> 
           <phase>package</phase> 
           <goals> 
            <goal>single</goal> 
           </goals> 
           <configuration> 
            <descriptors> 
             <descriptor>${basedir}/src/main/assembly/felix.xml</descriptor> 
            </descriptors> 
            <finalName>${project.build.finalName}</finalName> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
     <profile> 
      <id>run-on-felix</id> 
      <dependencies> 
       <dependency> 
        <groupId>org.apache.felix</groupId> 
        <artifactId>org.apache.felix.main</artifactId> 
        <version>4.0.3</version> 
        <scope>provided</scope> 
       </dependency> 
       <!-- org.apache.felix:org.apache.felix.gogo.shell:0.6.1 useless from Maven since stdin is swallowed --> 
      </dependencies> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-antrun-plugin</artifactId> 
         <version>1.7</version> 
         <configuration> 
          <target> 
           <property name="vm.args" value=""/> 
           <pathconvert property="plugins.jars" pathsep="${path.separator}"> 
            <path refid="maven.runtime.classpath"/> 
            <map from="${project.build.directory}${file.separator}classes" to=""/> 
           </pathconvert> 
           <makeurl property="urls" separator=" "> 
            <path path="${plugins.jars}"/> 
            <path location="${project.build.directory}/${project.build.finalName}.jar"/> 
           </makeurl> 
           <propertyfile file="${project.build.directory}/run.properties"> 
            <entry key="felix.auto.start" value="${urls}"/> 
            <entry key="felix.auto.deploy.action" value="uninstall,install,update,start"/> 
            <entry key="org.osgi.framework.storage" value="${project.build.directory}${file.separator}felix-cache"/> 
            <entry key="org.osgi.framework.bootdelegation" value="*"/> 
           </propertyfile> 
           <makeurl property="run.properties.url" file="${project.build.directory}/run.properties"/> 
           <java fork="true" jar="${maven.dependency.org.apache.felix.org.apache.felix.main.jar.path}"> 
            <sysproperty key="felix.config.properties" value="${run.properties.url}"/> 
            <jvmarg line="${vm.args}"/> 
           </java> 
          </target> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 

Sonucu aynı olmasıdır. maven-dependency-plugin 'ın copy hedef projeniz ikili eserler target klasöründe kullanılabilir olmadan önce hangi çalıştırmadan sırasında eklenti mevcut bağımlılıkları kopyalayabilirsiniz kullanma

+0

Sunucunuza yalnızca sahte bir kavanoz kopyalayan küçük bir test oluşturabilir misiniz? – higuaro

+0

@higuaro Seni anlamıyorum. Küçük bir sınav ne demek istiyorsun? –

+0

Sadece başarısız projenin adımlarını taklit eden maven tarafından yapılan basit bir "merhaba dünya" projesi. Bu oyuncak projesinin fikri, sorunu yeniden üretmektir ve bunun başarısız olan kısmına odaklanmaktır. – higuaro

cevap

1

. senin ~.m2/settings.xml yılında

<project> 
    ... 
    <distributionManagement> 
    <repository> 
     <id>ftp-repository</id> 
     <url>ftp://repository.mycompany.com/repository</url> 
    </repository> 
    </distributionManagement> 

    <build> 
    <extensions> 
     <!-- Enabling the use of FTP --> 
     <extension> 
     <groupId>org.apache.maven.wagon</groupId> 
     <artifactId>wagon-ftp</artifactId> 
     <version>2.9</version> 
     </extension> 
    </extensions> 
    </build> 
    ... 
</project> 
  • : En pom içinde

    • :

      FTP projenizin ikili eserleri yüklemek için lütfen şu adresi kullanın
    <settings> 
        ... 
        <servers> 
        <server> 
         <id>ftp-repository</id> 
         <username>user</username> 
         <password>pass</password> 
        </server> 
        </servers> 
        ... 
    </settings> 
    

    pom gelen id ayarlarında id maçları unutmayınız.

+0

Yükseltme, dosyaları karşıya yüklemenin başka bir yoludur, ancak benim sorunumun çözümü değil. –

+0

Sağladığınız çözüm, dosyaları maven repo url ilkelerine göre kopyalarken hiç yardımcı olmaz. –

+0

@iJava diğer olası seçenek maven karınca eklentisini kullanmaktır: http://stackoverflow.com/questions/3935433/upload-file-via-ant-ftp-task-in-maven – diginoise

İlgili konular