我正在建设一个新的微服务,我不得不使用第三方客户端库来解决的地理位置。我已经加入该服务的依赖性在我的POM文件
<groupId>abc.xyz.abc.geo</groupId>
<artifactId>MyGeoLocation</artifactId>
<version>1.5.0</version>
</dependency>
但我怎么注入在我的新服务/应用该服务的依赖?
据dropwizard docs你应该产生一个fat-jar。它们包括如何与maven-shade
做到这一点的例子
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.helloworld.HelloWorldApplication</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
记住要改变这种com.example.helloworld...
类项目的主类。