‎2020 May 18 2:52 PM - edited ‎2024 Feb 03 6:15 PM
Let's say I want to use opencsv. I have added the dependency in `external-dependencies.xml` asked to download the dependency by saying usemaven='true'. The jar file is downloaded and stored in the lib folder of the extension.

Now if I want to use this dependency to generate Java bean which contains annotation example.
<bean class="com.something.dto.IndirectSaleData">
<import type="com.opencsv.bean.CsvBindByName"/>
<property name="firstName" type="java.lang.String">
<annotations>@CsvBindByName(column = "first_name", required = true)</annotations>
</property>
</bean>
Why is it not able to resolve the dependency?

On the other hand if I directly create the Java Class it works totally fine example-
import com.opencsv.bean.CsvBindByName;
public class Data {
@CsvBindByName(column = "first_name", required = true)
private String name;
}
Request clarification before answering.
There is a way to plug in the dependency in the build class path. We can use `buildcallbacks.xml` for this. What I did is I moved the external dependency to `platform/core/lib` as I want it to be available during generation of model classes. code snippets:
<macrodef name="yourExtensionName_before_build">
<sequential>
<echo message="Copy external jar to platform core"/>
<!-- Copy the jar from your extension lib folder to platform core -->
<copy file="${ext.yourExtensionName.path}/lib/your-dependency.jar" todir="${platformhome}/ext/core/lib" failonerror="true"/>
</sequential>
</macrodef>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.