using maven source plugin and upload source jar file successfully. while download maven sources from another computer and found source file chinese words messy.here is my build configuration in pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<configuration><encoding>UTF-8</encoding>UTF-8<charset></charset></configuration>
<executions>
<execution>
<id>attach-sources></id>
<phase>jar</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
you can use <encoding>UTF-8</encoding>
with maven-resources-plugin 3.0.2
plugin, you can find code belop:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
...
<encoding>UTF-8</encoding>
...
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
and if you are using Maven 3.x then you useadd below code
<project>
...
<build>
<sourceEncoding>UTF-8</sourceEncoding>
...
</build>
...
</project>
and Maven 2.x, use below property:
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
</properties>
...
</project>
The only solution which is valid is this one:
<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
</properties>
...
</project>
This solution is not related to Maven version (apart from that Maven 2 is end of life)..
This will set this property which is picked up by all apache maven plugins (maven-compiler-plugin,maven-resources-plugin etc.) which includes maven-sources-plugin. But you should use most recent versions of the plugin and not such ancient version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.