Using registered app components in maven local repo

Here’s what happened (I’m using premium version of studio):

  1. I have this “accounts” project. Already install as app components.
  2. I have this “sales” project, and I want to use “accounts” as component of this project.
  3. I realized that I have to use local maven repository, in order to use “accounts” project as component.
  4. When I add local maven as repository, everything is work. Premium repo and local repo is working together. But whenever I add the project as component, the studio execute “Clean” and then only left me with local repo (IT AUTOMATICALLY DELETE THE PREMIUM REPO I HAVE MADE).

So, in this case. what should I do? And anothe rquestion is, after I add the component, I should be able to use the Entity in the component module in my primary ServiceBean right?

Hi,

Could you please bring more details of what you did?

Did you modify the build.gradle using IDE? Or local Maven was added in Studio? What do you mean saying “you have made a repo”?

Sorry, I guess my question in the beginning is very confusing. Here it is, I’m trying to explain.

Whenever you want to use a CUBA app as component, you need to install them as app component right? And when you install that, it will be on the local maven repository, so you can get that later as dependency.

But on the other hand, you need cuba-plugin, etc, and you got that from online premium repository. Which means you need 2 repositories. One from local, one from online.

I can use local maven repository and online premium repository just fine. But, using studio, when I try to add app components from registered applications (which is one I already made, and already installed), studio execute gradle clean. And when it completes, it removes the online premium repository, leaves me with just local maven repo, and that’s why I cannot use cuba-plugin.

I already try to edit the build.gradle, and add the repository by myself. But if I do that, somehow the studio doesn’t recognize it. And it will be either I don’t have my app components as dependency (although the build.gradle already mention it) or that it will remove one of the repository from build.gradle again.

Any help for this problem? Please?

Hi,

Sorry for the late answer.

At first, I should say that the premium repo appears in the project only when needed.

Let me describe the logic which is implemented in the current version of Studio (6.3.4 and 6.4.0.RC2 at the moment of writing):

1)The standard CUBA repo is used in every project.


 maven {
            url 'https://repo.cuba-platform.com/content/groups/work'
            credentials {
...
  1. The premium repo is used for premium add-ons (reports, FTS, charts, BPM ). It means if you enable one of them in your project the ‘‘premium repo’’ is added to repositories. And we can see it in the build.gradle file.

 maven {
            url 'https://repo.cuba-platform.com/content/groups/premium'
            credentials {
                ....
        }
  1. When some custom component is added, “mavenLocal()” appears.

 repositories {
        mavenLocal()
        maven {
            url 'https://repo.cuba-platform.com/content/groups/work'
        ....
  1. If the added custom component uses premium add-ons the corresponding checkboxes in the extension are also enabled and the premium repo is added.

So could you answer a few questions:

  1. Which version of Studio do you use?
  2. Which version of the platform do you use in your component projects and extension?
  3. Where do you use premium add-ons? In components or extension?

premiumAddons

Yes. I understand that what you’ve explained should be the logic that suppose to be done.

Maybe before I’d answer the questions first:

  1. Studio version 6.3.4.
  2. Both the project and components are using platform 6.3.6
  3. I use the premium add-ons on the app (or main project, you call it as extension?).

After a lot of workaround, I’m rewrite the build.gradle by myself. By adding the mavenLocal() and premium repo by itself, and also it’s dependencies referring to the components. For now, I can run the application and it will create the database and I can use screens from the components.

But if I make changes through studio, it will automatically remove the premium repo again, (giving me only the local maven repository). So I guess, right now it’s a bug on studio. And I hope it can be fixed soon.

And another question, why although no error was found when running or assembling the application, but IDE (IntelliJ IDEA 2016.3 latest) still shows error on the class using the Entity from component. Although when build nothing goes error. This make me cannot use the services or Entity in my main project’s service bean. Do you have any idea about that?