Cross project source dependency in rule based model

I am looking at using the new Software Model and would like to define source files in one project, but in a different project need to read the source files as well. Is it possible to access another project’s model and read where the source sets are?

There currently no way to access another project’s model. Right now interaction between projects is limited to component dependencies. In reality, all interactions between projects should be via dependencies on some publishable binary/artifact.

Can you elaborate on your use case? Are you simply trying to avoid duplicate configuration across projects?

It would be great if I could do it with dependencies but alas, I don’t believe it is possible.

I’m writing a plugin that needs to interact with the component model (Play plugin) and does code generation. There are two places that the description files should live (by design). For the code gen to work right, the generator (java process) needs to be able to read both of the source tree’s. The best practice right now is to keep them in different gradle projects and was never a problem before because we could reach out and over to access that project.

Could this be modeled simply as a separate component of the same project? One of the things about the new software model is the line between “projects” becomes a bit more obscure. What would be a multi-project build in the legacy model can now be modeled in a single project with multiple components.

Thats an interesting thought… That could work. Would it be possible to make this work with both the legacy plugins (whats the right name for it?) and the rule based plugins?

When you declare multiple components how does publishing work with non model projects? One jar needs to be published so that others can consume it.

Do you know when more ‘advanced’ documentation will be available for the model? I have fallen into just reading source code and the javadoc for some of it seem to not work as expected.

That would continue to be a problem. Right now legacy project dependencies won’t work for projects that declare multiple publications.

Soon :slightly_smiling:

Hum… Would I be able to publish to multiple configurations and have the legacy projects depend on a configuration?

I hope it’s not a Blizzard style soon. :slightly_smiling:

That is a potential workaround. If you are publishing Ivy modules as well that will work for consuming via an external dependency as well. This typically won’t work for folks publishing POMs since all artifacts will share the same dependencies.

As it turns out, I am publishing using Ivy :slight_smile:

Is there anything special for publishing multiple artifacts from different components with the model?

If you are already publishing binaries then I don’t imagine there would be anything special about it other than ensuring the artifact names are different (unique classifiers, etc).

Awesome thanks Mark!