maven assembly 打包插件问题

kleen 发布于 2017/06/14 21:01
阅读 542
收藏 0

 

使用idea maven assembly  插件打包, 执行脚本打包出来之后 

pom.xml 

<plugins>
            <!-- The configuration of maven-assembly-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!--名字任意 -->
                        <phase>package</phase>  <!-- 绑定到package生命周期阶段上 -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>src/main/assembly/assembly.xml</descriptor>
                            </descriptors>
                            <archiverConfig>
                                <encoding>utf-8</encoding>
                            </archiverConfig>
                            <outputDirectory>${project.build.directory}/dist/</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
<assembly>
	<id>package</id>
	<formats>
		<format>zip</format>
	</formats>
	<includeBaseDirectory>true</includeBaseDirectory>
	<fileSets>

		<fileSet>
			<directory>${project.basedir}/../../gts-config/src/main/resources</directory>
			<outputDirectory>conf</outputDirectory>
		</fileSet>

		<fileSet>
			<directory>${project.basedir}/../../gts-config/src/main/resources_${build.type}</directory>
			<outputDirectory>conf</outputDirectory>
		</fileSet>

		<fileSet>
			<directory>src/main/resources</directory>
			<outputDirectory>conf</outputDirectory>
		</fileSet>

		<fileSet>
			<directory>src/main/bin</directory>
			<outputDirectory>/</outputDirectory>
		</fileSet>

	</fileSets>
	<dependencySets>
		<dependencySet>
			<outputDirectory>lib</outputDirectory>
		</dependencySet>
	</dependencySets>
</assembly>

打包,解压

然后执行 ./start.sh 报错

[root@localhost gts-provider-base]# ./start.sh 
-bash: ./start.sh: /bin/bash^M: bad interpreter: No such file or directory

但是通过 vi start.sh 把本地内容重新复制,到start.sh 再次执行 脚本 就可以正常执行;请问是什么原因? 如何避免

脚本的编码格式为 UTF-8

服务器编码格式 UTF-8 

[root@test gts-provider-base]# echo $LANG
en_US.UTF-8

 

@红薯  给指条明路吧

加载中
0
kleen
kleen

http://blog.csdn.net/yongan1006/article/details/8142527 这个只治标,无法治本

返回顶部
顶部