Maven:复制到FTP抛出java.io.IOException:非法寻找【JAVA教程】

!
也想出现在这里? 联系我们
信息

Maven:复制到FTP抛出java.io.IOException:非法寻找,第1张

概述Maven:复制到FTP抛出java.io.IOException:非法寻找

我有一个桌面(centos 7.1)和一个FTP服务器(GF4在这里)。 而我想在Maven构build到ftp服务器(巫婆由 *** 安装)后复制文件但是我得到这个:

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=XXXX,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

创build文件夹/run/user/1000/gvfs/ftp:host=XXXX,port=XXX/glassfish4/glassfish/domains/domain3/autodeploy/bundles/temp.jar中的文件,但其大小= 0。 除此之外,我手工复制:

cp /home/myuser/temp/target/temp.jar /run/user/1000/gvfs/ftp:host=XXXX,port=XXX/glassfish4/glassfish/domains/domain3/autodeploy/bundles/

一切都好。 如何解决它?

EDIT1

我创build了一个只包含激活器的空osgi项目。 这是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>

结果是相同的 – 在目标文件夹hworld-1.0。 – 创buildSNAPSHOT.jar,但其大小= 0。

rpm.spec文件中的多个tar(源文件)文件

在txt文件上显示PHP输出linux命令行

Docker升级问题6.5

在linux / CentOS上安装和升级Java而不提示

提供gunicorn的请求

linuxterminal:键盘快捷键跨标签

Wget通过SSL给出:无法build立SSL连接

无法在Centos 7上启动Varnish 3服务

安装mod_ssl亚马逊linux

手动修补传统服务器上的Ghost漏洞

使用maven-dependency-plugin的copy目标,你可以在运行的时候复制插件可用的依赖项,也就是说你的项目的二进制文件在target文件夹中可用。

要将项目的二进制文件上传到FTP,请使用以下命令:

在你的朋友:

<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>

在你的~.m2/settings.xml

<settings> … <servers> <server> <ID>ftp-repository</ID> <username>user</username> <password>pass</password> </server> </servers> … </settings>

请注意,来自POM的ID与设置中的ID匹配。

总结

以上是内存溢出为你收集整理的Maven:复制到FTP抛出java.io.IOException:非法寻找全部内容,希望文章能够帮你解决Maven:复制到FTP抛出java.io.IOException:非法寻找所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

© 版权声明
THE END
喜欢就支持一下吧
点赞162 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容