# How to use the new generated DL4J artifact in DL4J-examples project?

**URL:** <https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472>\
**Category:** Uncategorized\
**Created:** [April 11, 2023, 2:16am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472 "2023-04-11T02:16:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 2:16am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/1 "2023-04-11T02:16:10Z")

</div>

I have built and installed the DL4J project under Linux, and generated the ND4J artifacts like this:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/4/4df434386c21a333ad513a52827f7bf862a52c93.png)

Once I use the snapshot in the example project:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/8/8a2d814bae48887d2e75d98320c994193d5f6ee1.png)

A test error is reported:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/3/37f692e9aa1ab988cac5c2e41b364d08f7ea8350.png)

How can I use the new generated backend snapshot in dl4j-examples project? I am not familiar with pom file and maven. Thanks!

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 2:26am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/2 "2023-04-11T02:26:33Z")

</div>

@yaoyao that’s all you should need to do. If you built it locally and installed it via maven like I mentioned there’s nothing else to do. You just specify the version and you’re done. Could you clarify what your exact problem is? The test failure above doesn’t tell me why it failed. I’d need more information to go off of. Can you post the full run?

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 3:16am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/3 "2023-04-11T03:16:21Z")

</div>

Thanks for your help. Now, I modify nothing in ND4J, and generate the new jar package. And I can successfully compile the dl4j-examples project. However, when I run the LeNetMNIST.java by the command _mvn exec:java -Dexec.mainClass=“org.deeplearning4j.examples.quickstart.modeling.convolution.LeNetMNIST”_ the error occurs:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/0/0f6c2609dc80b2193c87cf8b2d550b9e9bbb7e36.png)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/2/2228095bd1250a54785e946a9d2dd25b4bc2bb00.png)

What causes this? Maybe I lost something?

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 3:29am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/4 "2023-04-11T03:29:26Z")

</div>

@yaoyao did you do something special like run mvn -pl :nd4j-native only? Your issue is due to using an old version of snapshots. It feels like you’re mixing old snapshots with the local source one. That shouldn’t happen if you run the build from the root.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 4:25am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/5 "2023-04-11T04:25:37Z")

</div>

I built the dl4j project just by command _mvn clean install -DskipTests -T 40_ as you suggested before, and the snapshots in my .m2/repo are all new-generated as shown:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/6/66005031689cf356736b4c4fb5752237f9cad9b0.png)

But the error still occurs… ☹

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 4:28am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/6 "2023-04-11T04:28:04Z")

</div>

@yaoyao you might have old dependencies laying around. Could you please rm -rf org/nd4j under your .m2 and rebuild just incase?

Note: I am not advocating for removing _all_ your .m2. Just the org/nd4j folder.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 6:17am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/7 "2023-04-11T06:17:57Z")

</div>

I run the rm command, and the repo looks like (without nd4j):

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/b/b9fa5ed67f300eedcd0b02e8efa697c1ccfdbcda.png)

and I built the nd4j in its root dir:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/3/37aea92567b86da5d0c1a8b2b99ba70927ab20be.png)

I will try it ASAP.

In dl4j-examples dir, I usually run _mvn compile -T 40_ to compile the project, is the command correct ?

(BTW, i need nearly 20minutes to compile the libnd4j, any methods can speedup it?)

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 6:18am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/8 "2023-04-11T06:18:28Z")

</div>

@yaoyao You need to run with mvn -Pcpu nd4j-native is not included by default. I mentioned that earlier.

Edit: Please differentiate between the examples and dl4j. Note that rebuilding the examples won’t help you unless you’re using an uber jar.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 6:25am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/9 "2023-04-11T06:25:55Z")

</div>

In fact, I can build the DL4J project successfully.

Then i modify the pom file (from M2.1 to snapshot) in DL4J-examples dir, because I want to use the new built DL4J in examples.

The error is reported from DL4J-examples project, rather than DL4J project.

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 6:30am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/10 "2023-04-11T06:30:52Z")

</div>

@yaoyao you’re ignoring why I told you to rebuild in the first place though. You need to regenerate the dl4j dependencies in order to use them.  
I told you to regenerate those dependencies because you had old snapshots laying around that were incompatible with the current build.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 6:34am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/11 "2023-04-11T06:34:28Z")

</div>

I rebuilt & regenerated the dl4j project successfully now with your warmheart help. Please guide me what should I do/run which command next?

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 6:37am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/12 "2023-04-11T06:37:39Z")

</div>

@yaoyao great then just rebuild the project with standard mvn clean install or if you’re using intellij just rerun the project with that and let me now what you get.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 6:46am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/13 "2023-04-11T06:46:06Z")

</div>

Thanks. I am rebuilding the project. But the make process for libnd4j is too slow, any method can speedup it?

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/b/be23fef5653487b70a5a0f81b99eb2311a58d6df.png)

It needs nearly 20+ minutes each time I build it …

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 6:47am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/14 "2023-04-11T06:47:53Z")

</div>

@yaoyao Add -Dlibnd4j.buildthreads=4

That “4” can be however many cores you have on your computer. That’s equivalent to make -j if you’re familiar with that.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 6:53am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/15 "2023-04-11T06:53:34Z")

</div>

I have rebuilt the DL4J project now.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/b/b4d18c02136230e4359eed9daf85fd3e4ea1233d.png)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/a/ae14c6a4e760604d2d5c704ac9d5977b568f879a.png)

Please guide me how to use the new dl4j in DL4J-EXAMPLES project 🥰

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 6:55am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/16 "2023-04-11T06:55:02Z")

</div>

@yaoyao just rerun your code. Everything is automatically used correctly now. You just need that 1.0.0-SNAPSHOT specified and it needs to be the correct version of the snapshots.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 7:00am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/17 "2023-04-11T07:00:59Z")

</div>

I modify the version of nd4j-native in DL4J-examples pom.xml.

I want to confirm: You mean I don’t need to rebuilt the DL4J-examples project ? Just modify the version in pom?

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 7:02am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/18 "2023-04-11T07:02:44Z")

</div>

I just modify the pom file. Then I run the java file, the mvn downloads some files like this:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/2/2a6461ea521cd5038eac3a8da407561d656be844.png)

The error still exists:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/3/36c58ef2760b409a84d0d439b805b7ae34dd7b3f.png)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/4/473a14e1aa836efa27ed7e30dd7aaebcaf5308f3.png)

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 11, 2023, 7:05am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/19 "2023-04-11T07:05:32Z")

</div>

@yaoyao wait are you trying to use M2.1 with _just_ nd4j-native as snapshots? Do _not_ mix versions. Everything has to be the same.

---

<div class="post-metadata">

**Author:** ![yaoyao](https://avatars.discourse-cdn.com/v4/letter/y/f6c823/32.png) [@yaoyao](https://community.konduit.ai/u/yaoyao)\
**Post date:** [April 11, 2023, 7:10am UTC](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472/20 "2023-04-11T07:10:10Z")

</div>

I have changed all dl4j-related versions from M2.1 to SNAPSHOT

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/2X/e/e688c48a47929c22256c92d5b9fd394c0ea5ea52.png)

[Next page](https://community.konduit.ai/t/how-to-use-the-new-generated-dl4j-artifact-in-dl4j-examples-project/2472.md?page=2)
