Exception in thread "main" com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf
@ jar:file:/Users/wending/IdeaProjects/flink-scala/target/flink-scala-1.0-SNAPSHOT.jar!/reference.conf: 804: Could not resolve substitution to a value: ${akka.stream.materializer}
reference.conf 多个jar包都有这个文件,同名文件会覆盖导致这个不能解析${akka.stream.materializer}这不能被解析
看打包方式为maven-assembly-plugin,原来这个插件有BUG
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<!-- 此处指定main方法入口的class -->
<mainClass>com.link.StreamingJob</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
打包插件 | 同名文件处理 |
---|---|
maven-assembly-plugin | 覆盖 |
maven-shade-plugin | 追加 |
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<transformers>
<!--对这个同名文件进行追加处理-->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<!--设置主函数-->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.daojia.flink.StreamingJob</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
遇到这种问题,使用maven-shade-plugin解决