3

In 2019, has anyone succeeded adding maven dependencies in Talend OpenStudio?

tLibraryLoad is not a solution unless you have a whole life to load tens of jars one by one.

As an example, would you suggest a method to use jersey jax-rs client in the Studio ?

Thanks

2 Answers2

4

I'm not sure if it's an official way of doing things, but amending the project maven XML seems to work for me, in the Talend ESB 7.1 environment.

Please note however, that I didn't want the relevant libraries included in the deployment .kar file, and this achieves using it in Studio, but not deploying it in the build.

In File/Edit Project Properties, in the Build/Maven/Default/Project tab, I have added a dependencies section at the end of the project element, and this seems to work.

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 ...
 <dependencies>
    <dependency>
      <groupId>org.example.groupName</groupId>
      <artifactId>packageName</artifactId> 
      <version>0.0.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>

If anyone has a better answer, I'd be pleased to see it, because I'm not that happy with this approach myself.

Screwtape
  • 1,337
  • 2
  • 12
  • 27
  • Is there a step I missed after adding those lines to project properties? The jars are not being downloaded – Navalona Ramanantoanina Jan 28 '19 at 12:10
  • 1
    I had to disable offline mode in Window > Preferences > Maven and enabled artifact download. So, in this method, how do you make sure dependencies are satisfied when deployed (1) as a standalone job, (2) as an OSGi bundle for ESB ? – Navalona Ramanantoanina Jan 28 '19 at 13:11
  • That I haven't figured out - my dependency was a bundle I built, so I deployed it manually to OSGi. – Screwtape Jan 30 '19 at 13:00
0

-Close the tab that have your java code (if it's open)

-Right click on your java class where you want to add the dependency (under Code folder)

-Choose "Edit Routine Libraries"

-Hit the "New..." button

-Choose Platform and select your dependency from the List

-Confirm by hitting OK enter image description here

Rabhi salim
  • 486
  • 5
  • 17