gpt4 book ai didi

java - 用于编码 utf8 的不可映射字符

转载 作者:行者123 更新时间:2023-12-05 07:54:07 25 4
gpt4 key购买 nike

在使用 maven 构建项目时。我收到这个错误

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project uidai-auth-client: Compilation failure
[ERROR] /uidai-auth-client-1.6-src/uidai-auth-client/src/main/java/in/gov/uidai/auth/aua/httpclient/NamespaceFilter.java:[91,44] error: unmappable character for encoding UTF-8
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project uidai-auth-client: Compilation failure
/uidai-auth-client-1.6-src/uidai-auth-client/src/main/java/in/gov/uidai/auth/aua/httpclient/NamespaceFilter.java:[91,44] error: unmappable character for encoding UTF-8

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
/uidai-auth-client-1.6-src/uidai-auth-client/src/main/java/in/gov/uidai/auth/aua/httpclient/NamespaceFilter.java:[91,44] error: unmappable character for encoding UTF-8

at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]

谁能帮我解决这个问题。

最佳答案

显然,您的源文件的编码不是 UTF-8。

找出它是什么编码(比如 ISO-8859-1),然后像这样在 POM 中指定编码:

<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>

最好始终明确指定编码,以避免依赖于平台编码(即操作系统默认值)。否则,Maven 将打印一条警告。

关于java - 用于编码 utf8 的不可映射字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31729741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com