- Posts: 19
- Thank you received: 0
×
Modelio 4.0.0 released (07 Nov 2019)
Modelio 4.0.0 has been released ( www.modelio.org/forum/4-announcements/45...-4-0-0-released.html )
[Solved] Generate Directory without creating namespace
10 years 8 months ago - 10 years 8 months ago #186 by michok34
Hi!
My purpose is to create an ordered project's workspace.
Consider a model like this :I succeed to generate :
but it also generates :
c:\all_workspace\Proj1\src\pkg1\Class1.javac:\all_workspace\Proj1\test\pkg1\Class1_Test.java
And I want :
c:\all_workspace\Proj1\src\pkg1\Class1.javac:\all_workspace\Proj1\test\pkg1\Class1_Test.java
Would you please give me some advise
Thanks
My purpose is to create an ordered project's workspace.
Consider a model like this :
Proj1
|_src
|_ pkg1
|_Class1
|_test
|_ pkg1
|_Class1_Test
c:
|_all_workspace
|_Proj1
|_src
|_ pkg1
|_Class1.java
|_test
|_ pkg1
|_Class1_Test.java
but it also generates :
c:\all_workspace\Proj1\src\pkg1\Class1.java
package src.pkg1;
public class Class1 {
}
package test.pkg1;
public class Class1_Test {
}
And I want :
c:\all_workspace\Proj1\src\pkg1\Class1.java
package pkg1;
public class Class1 {
}
package pkg1;
public class Class1_Test {
}
Would you please give me some advise
Thanks
Last Edit: 10 years 8 months ago by chm.
The topic has been locked.
10 years 8 months 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 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.
10 years 8 months ago - 10 years 8 months 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!
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!
Last Edit: 10 years 8 months ago by ebr. Reason: Solving typos
The topic has been locked.
Time to create page: 0.307 seconds