FWIW, maven-shade-plugin configuration that properly merges META-INF/services 
contents and thus preserves module auto-loading may look like the following 
(taken from Bootique.io) :

<properties>
        <main.class>.....</main.class>
</properties>
...
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <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>${main.class}</mainClass>
                                        </transformer>
                                </transformers>
                        </configuration>
                </execution>
        </executions>
</plugin>

Andrus

> On Oct 12, 2017, at 8:13 PM, Nikita Timofeev <[email protected]> 
> wrote:
> 
> You are welcome!
> 
> It is not a dependency problem it's a Cayenne module loading problem.
> Java8 module wasn't enabled, thus causing your troubles.
> If meta information is there (file in META-INF/services/) Cayenne will
> load module without any help, but as it's not you should do this
> explicitly.
> 
> On Thu, Oct 12, 2017 at 8:04 PM, Andrew Willerding
> <[email protected]> wrote:
>> Thank you so much Nikita!  That did the trick!  I would never have been able
>> to figure this out on my own.
>> 
>> I'm new to Maven as a build tool and I've never heard of the shade plugin.
>> When I was trying to figure out how to build a JAR file with all
>> dependencies I found this method via a Google search which seemed to do the
>> trick except for this project.  Out of curiosity, why would adding the Java8
>> module explicitly allow Cayenne to find the dependencies?
>> 
>> 
>>            <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-assembly-plugin</artifactId>
>>                <version>2.6</version>
>>                <configuration>
>>                    <archive>
>>                        <manifest>
>> <addClasspath>true</addClasspath>
>> <mainClass>com.callistacti.quest.crsolstasv2.CRSolstas</mainClass>
>> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
>> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
>>                        </manifest>
>>                    </archive>
>>                    <descriptorRefs>
>> <descriptorRefs>jar-with-dependencies</descriptorRefs>
>>                    </descriptorRefs>
>>                </configuration>
>>                <executions>
>>                    <execution>
>>                        <!--id>make-assembly</id--> <!-- this is used for
>> inheritance merges -->
>>                        <phase>package</phase> <!-- bind to the packaging
>> phase -->
>>                        <goals>
>>                            <goal>single</goal>
>>                        </goals>
>>                    </execution>
>>                </executions>
>>            </plugin>
>>        </plugins>
>> 
>> 
>> On 12/10/17 12:51 PM, Nikita Timofeev wrote:
>>> 
>>> ServerRuntime.builder().addModule(new Java8Module())
>> 
>> 
> 
> 
> 
> -- 
> Best regards,
> Nikita Timofeev

Reply via email to