lock [Solved] Generate Directory without creating namespace

7 years 11 months ago - 7 years 11 months ago #186 by michok34
Hi!

My purpose is to create an ordered project's workspace.
Consider a model like this :
Proj1
  |_src
    |_ pkg1
      |_Class1
  |_test
    |_ pkg1
      |_Class1_Test
I succeed to generate :
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 {
}
c:\all_workspace\Proj1\test\pkg1\Class1_Test.java
package test.pkg1;
public class Class1_Test {
}

And I want :
c:\all_workspace\Proj1\src\pkg1\Class1.java
package pkg1;
public class Class1 {
}
c:\all_workspace\Proj1\test\pkg1\Class1_Test.java
package pkg1;
public class Class1_Test {
}

Would you please give me some advise

Thanks
The topic has been locked.
7 years 11 months ago #187 by ebr
Hi,

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

Regards,

ebr
The topic has been locked.
7 years 11 months ago #188 by tma
See this post .
The topic has been locked.
7 years 11 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 topic has been locked.
7 years 11 months ago - 7 years 11 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!
Attachments:
The topic has been locked.
7 years 11 months ago #191 by ebr
Hi,

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

Regards,

ebr
The topic has been locked.
Moderators: tmachmebr
Time to create page: 0.234 seconds
^ Back to Top