The idea is to use or refer the dwl files from domain project so the same DataWeave files can be refer to the n number of projects. The other project should not have dwl folder.
But we are not able to refer/define file from domain project.
I tried with another option to create DataWeave library and publish to exchange but there we have to define function and from anywhere we can import and use the function but that is not fulfilling our requirements as for that also we need to write n number of line in transform message and pass all the arguments.
I want this kind of logic where we can define the source code file path in transform message and the code should be refer from the domain project DataWeave file.
If you add a DataWeave file in the src/main/resources folder (or a subfolder of it) in the domain project you can reference it just by name, including the relative path if in a subfolder. Exactly the same that if it was in the application.
For example if the domain has file src/main/folder/dw/x.dwl then in the application you could reference it in a Transform component as if it were local to the application:
<ee:transform doc:name="Transform Message" >
<ee:message >
<ee:set-payload resource="dw/x.dwl" />
</ee:message>
</ee:transform>
Modules would work in the same way.
Libraries should work similarly though I haven't tried it.