Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

difference between the maven central apoc-core jar and the one on the release page for version 5.x #259

Closed
ThomasBorghs opened this issue Dec 2, 2022 · 9 comments

Comments

@ThomasBorghs
Copy link

Expected Behavior (Mandatory)

That including

<dependency>
    <groupId>org.neo4j.procedure</groupId>
    <artifactId>apoc-core</artifactId>
    <version>5.2.1</version>
    <scope>runtime</scope>
</dependency>

in my project would have the same result as me manually downloading the apoc-core jar from the github releases page.

Actual Behavior (Mandatory)

Instead the version coming in through maven is missing some key functions, as compared to the one on the github page. An example of such a function which is missing in the maven central jar is apoc.coll.sort (which I ran into), but there are a lot of others also missing

How to Reproduce the Problem

set up a local docker container of neo4j, where you mount the apoc-core.jar (version 5.1 and up) you downloaded from maven central into the plugins dir of the container

apoc.coll.sort won't be available (amongst other functions which are also missing)

Steps (Mandatory)

  1. download apoc-core.jar version 5.1 or up from maven central
  2. launch neo4j 5.1 or up (in sync with your apoc version) in docker, and mount the apoc-core.jar in the plugins dir of the container
  3. try to run apoc.coll.sort, or run "show functions" to see which ones are missing

Specifications (Mandatory)

not sure what to write here, apologies

Currently used versions

5.2.1

Versions

  • OS: mac Os 12.4
  • Neo4j: 5.2
  • Neo4j-Apoc: 5.2.1
@gem-neo4j
Copy link
Contributor

Hey! I tried this out and couldn't reproduce the issue, are you able to share the Docker command you used with me? Thanks!

@ThomasBorghs
Copy link
Author

Hi Gem, thanks for your response!

We build our custom docker image using the docker maven plugin from fabric8. Below the relevant part of our project pom.xml file. As a bit of context: we build a custom docker image, based on the neo4j official community image. In our custom image we package our entire project as customer stored procedures and user functions. (rtim is our project name)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>rtim-neo4j</artifactId>
    <version>${revision}</version>
    <packaging>jar</packaging>

    <name>RTIM neo4j</name>

    <properties>
        <revision>4.0.0-SNAPSHOT</revision>
        <docker.image.version>${project.version}</docker.image.version>
        <docker.source.directory>${project.build.directory}${file.separator}docker-source</docker.source.directory>

        <version.jdk>17</version.jdk>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven-dependency-plugin.version>3.3.0</maven-dependency-plugin.version>

        <neo4j.version>5.1.0</neo4j.version>
        <neo4j.driver.version>5.1.0</neo4j.driver.version>
        <neo4j.apoc.version>5.1.0</neo4j.apoc.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j</artifactId>
            <version>${neo4j.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.neo4j.procedure</groupId>
            <artifactId>apoc-core</artifactId>
            <version>${neo4j.apoc.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.neo4j.procedure</groupId>
            <artifactId>apoc-common</artifactId>
            <version>${neo4j.apoc.version}</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                        <configuration>
                            <images>
                                <image>
                                    <name>283395560872.dkr.ecr.eu-west-1.amazonaws.com/rtim-neo4j:${docker.image.version}</name>
                                    <build>
                                        <from>neo4j:${neo4j.version}-community</from>
                                        <maintainer>The trainspotters</maintainer>
                                        <tags>
                                            <tag>latest</tag>
                                            <tag>${project.version}</tag>
                                        </tags>
                                        <assemblies>
                                            <assembly>
                                                <name>plugins</name>
                                                <targetDir>/var/lib/neo4j/plugins</targetDir>
                                                <inline>
                                                    <files>
                                                        <file>
                                                            <source>${project.build.directory}${file.separator}${project.build.finalName}.${project.packaging}</source>
                                                            <outputDirectory>.</outputDirectory>
                                                        </file>
                                                    </files>
                                                    <dependencySets>
                                                        <dependencySet>
                                                            <includes>
                                                                <include>org.neo4j.procedure:apoc-core:jar</include>
                                                                <include>org.neo4j.procedure:apoc-common:jar</include>
                                                                <include>${project.groupId}:${project.artifactId}:jar:${project.version}</include>
                                                            </includes>
                                                            <outputDirectory>.</outputDirectory>
                                                        </dependencySet>
                                                    </dependencySets>
                                                </inline>
                                            </assembly>
                                            <assembly>
                                                <name>config</name>
                                                <targetDir>/var/lib/neo4j/conf</targetDir>
                                                <inline>
                                                    <file>
                                                        <source>src/main/resources/log4j2.xml</source>
                                                    </file>
                                                </inline>
                                            </assembly>
                                        </assemblies>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Cheers,
Thomas

@gem-neo4j
Copy link
Contributor

Thanks for that, from my understanding, the APOC jar downloaded here is simply not containing all compiled dependencies needed for the other functions.

I added a few:
e.g

<dependency>
    <groupId>com.opencsv</groupId>
    <artifactId>opencsv</artifactId>
    <version>5.7.1</version>
</dependency>

And

<include>com.opencsv:opencsv:jar</include>

(see list of needed on Maven central)

and was able to load the missing ones in my Docker container.

When you download the jar from github, or manually download the 'fat' jar from Maven, the dependencies (as well as APOC common) are included.

Hope this helps :)

@ThomasBorghs
Copy link
Author

Ah okay, I was under the assumption that the maven central JAR would be exactly the same as the jar from github (because they have the same name). For now as a workaround we manually included the github 'fat jar' in our build cycle. I think we'll keep this approach, since managing the required dependencies ourselves would be a bit of a hassle.

Is there a specific reason not to make the fat jar available as a download in maven central? (maybe with an "all" classifier or something?). That would make our build cycle a bit easier, instead of either having to manually download new versions, or to make sure we include all the dependencies of the apoc libraries ourselves.

Thanks a bunch already for the help,
Thomas

@gem-neo4j
Copy link
Contributor

We have done a lot of shifting around with APOC since the 4.x series, I will make a ticket for us to investigate our workflow to see if we should be altering how our Maven uploads work :)

Sorry about the hassel and thanks for letting us know :)

@ThomasBorghs
Copy link
Author

No worries, many thanks for looking into it and for the follow-up!

@markslater
Copy link

Possibly related: The jar in Maven Central doesn't seem to work in the test harness for 5.x - it results in runtime exceptions, see: https://community.neo4j.com/t5/neo4j-graph-platform/using-apoc-with-test-harness-in-5-x/td-p/62849

@TomVanWemmel
Copy link

We found a core-classifier which has the same content as the jar on the release versions.
This solves the issue above.

<dependency>
    <groupId>org.neo4j.procedure</groupId>
    <artifactId>apoc-core</artifactId>
    <version>5.2.1</version>
    <scope>runtime</scope>
    <classifier>core</classifier>
</dependency>

@hvub
Copy link
Collaborator

hvub commented Dec 18, 2024

This issues seems to resolved by the last message on Jan 25, 2023. Closing now.

@hvub hvub closed this as completed Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants