lock [Solved] Generate Directory without creating namespace

8 years 1 week ago #187 by ebr

I just move the topic in the right place...


The topic has been locked.
8 years 1 week ago #188 by tma
See this post .
The topic has been locked.
8 years 1 week ago #189 by michok34
Thanks Tony but I already tried that.
The class generation gives the correct package namespace but fail to generate it to the right directory. it goes to c:\all_workspace\Proj1\src\src\pkg1\Class1.java and c:\all_workspace\Proj1\test\src\pkg1\Class1_Test.java
The topic has been locked.
8 years 1 week ago - 8 years 1 week ago #190 by chm
Hi michok34,

In my opinion, you should create two different projects, but there is a solution to generate your files where you want (including some drawbacks).

It is related to the solution given by tma, but slightly different:

You have to create two Java Components (one for "src" and one for "test") containing two Compilation Artifacts.

After selecting each artifact, go to the "annotation" view and fill the "generation path" property, available on the stereotype (one should contain "src" and the other "test").

Last, you have to remove "src" from your global generation directory, in the module parameters.

There you are, each generated class is now part of the appropriate directory, without changing the namespace.

The main drawback of this solution is that you have to select elements from one component at a time. Generating the project root or elements from both components won't work anymore... It could also become a nightmare when multiple artifacts changing the generation path are targeting different parts of the same namespaces.

Hope this helps!
The topic has been locked.
8 years 1 week ago #191 by ebr

My advise is also to create two different projects ...


The topic has been locked.
8 years 1 week ago #194 by michok34

Thanks for the advise. But I don't think that creating two different projects for each model and related test unit is a solution. It's like if I'd create two eclipse projects for the same solution.

Anyway here is how my modelio is configured:
General workspace : c:\all_workspace
Configuration>Settings>Java Designer>Directories:
code generation = c:\all_workspace\$(Project)

My Model is like TMA's Solution (please note I changed component's name to 'model' to disable misunderstood):
  |_model (Java Component : annotations/Generation Path=model|Top file=null)
    |_ pkg1  (Java Package)
      |_Class1  (Java Class)
  |_test (Java Component : annotations/Generation Path=test|Top file=null)
    |_ pkg1  (Java Package)
      |_Class1_Test (Java Class)

With this solution, generation path is c:\all_workspace\Proj1\model\src\pkg1 and c:\all_workspace\Proj1\test\src\pkg1

With CHM's solution, generation path is c:\all_workspace\Proj1\model\src\model\pkg1 and c:\all_workspace\Proj1\test\src\test\pkg1

In this last solution, if I set java component's annotation "generation path" to null, the new generation path is c:\all_workspace\Proj1\src\model\pkg1 and c:\all_workspace\Proj1\src\test\pkg1

It's almost what I'm looking for except I don't want that "src" directory.

Thanks for your help.
The topic has been locked.
Moderators: tmachmebr
Time to create page: 0.227 seconds
^ Back to Top