Spring Data Neo4j: using the Neo4j server with an embedded: JAR packaging

后端 未结 1 434
夕颜
夕颜 2021-01-22 11:25

I was finally able to create a server instance within my java app that uses the embedded database as explained here. This works properly while I\'m running it from Eclipse, but

相关标签:
1条回答
  • 2021-01-22 11:43

    I finally found a solution, which did the trick. I just share it, in case anyone else experiences the same issue. The problem was that some files under META-INF/services were being overwritten during the jar packaging process, since by default their content is not merged. According to the maven-shade plugin reference:

    JAR files providing implementations of some interfaces often ship with a META-INF/services/ directory that maps interfaces to their implementation classes for lookup by the service locator. To merge multiple implementations of the same interface into one service entry, the ServicesResourceTransformer can be used.

    So adding this transformer in my pom just worked, e.g.:

    <project>
      ...
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.0</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                  </transformers>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      ...
    </project>
    

    Hope it helps!

    0 讨论(0)
提交回复
热议问题