InvalidPathException: Malformed input or input contains unmappable ; maven-assembly-plugin maven j

Posted 星回中道

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了InvalidPathException: Malformed input or input contains unmappable ; maven-assembly-plugin maven j相关的知识,希望对你有一定的参考价值。

一、 hutools 依赖 centos7

<dependency>
    <groupId>cn.hutool</groupId>
    <artifactId>hutool-all</artifactId>
    <version>4.5.7</version>
</dependency>


FileUtil.copy(srcfilename, destfilename, true);

报错:
Caused by: java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: 
/home/face/facewatchertemps/images/???_495182728904310784_.jpg

二、测试替换方案;新项目
public class EncodeTest {
public static void main(String[] args) {
System.out.println("sun.jnu.encoding >>>" + System.getProperty("sun.jnu.encoding"));
System.out.println("file.encoding >>>" + System.getProperty("file.encoding"));

try {
FileUtils.copyFile(new File("/var/aiplatform/test/1.jpg"),new File("/var/aiplatform/test/张小泉呵呵_111_zxq.com.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
}
}

如下pom.xml 可以将 commons-io打到同一个jar包中。
<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.xx.test</groupId>
    <artifactId>testfile</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>

    <build>
      <finalName>testfile</finalName>
        <plugins>
            <!-- maven-assembly-plugin -->
            <!-- 打包方式:mvn package assembly:single  -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.5</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.xx.test.EncodeTest</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
maven package  # 打包成功

 java -jar testfile-jar-with-dependencies.jar  ## 执行文件复制成功。

  

 

  

以上是关于InvalidPathException: Malformed input or input contains unmappable ; maven-assembly-plugin maven j的主要内容,如果未能解决你的问题,请参考以下文章

从 hello-world 创建 scala 项目时出现 InvalidPathException

线程“主”java.nio.file.InvalidPathException 中的异常:索引 2 处的非法字符 <:>:

java.nio.file.InvalidPathException: Trailing char < > at index 10: res/raw/?

InvalidPathException: Malformed input or input contains unmappable ; maven-assembly-plugin maven j

我网站中的 Mal/Iframe-AL

安装错误:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED?