Poject using a source framework with restricted access

Layout on file system

Steps for defining corresponding projects

  1. Click Open VJET perspective Window > Open Perspective > Other... > VJET to change to the VJET perspective.

  2. Click Open new VJET project wizard File > New > Other... > VJET Project to open the New VJET Project wizard.

  3. Type "ProjectFramework" in the Project name field.

  4. In Contents group, change selection to Create project from existing source.

    Click Browse... and choose the C:\ProjectFramework directory.

    New VJET Project wizard

    Click Next.

  5. On the next page, verify that directory SourceFile has been automatically added as source folder.

    Expand it to preview your project source folder contents:

    VJET Project Source setup

  6. Click Finish.
  7. Repeat step1 to create a new VJET project.

  8. On the next page, type "Project" in the Project name field.

  9. In Contents group, change selection to Create project from existing source.

    Click Browse... and choose the C:\Project directory.

    New VJET Project wizard

  10. Click Next.

  11. On the next page, verify that directory SourceFile has been automatically added as source folder.

    Expand it to preview your project source folder contents:

    VJET Project Source setup

  12. Select Projects tab.

    Click Add...to add a dependency to source framework project...

    VJET Project Required Projects setup

  13. In Required Project Selection, check "ProjectFramework".

    Required Project Selection dialog

  14. Click OK to validate and close dialog.

  15. Now, let's put access rules on source framework content to authorize, discourage or forbid access to "ProjectFramework" source folders, package and classes...

    In Projects tab, select "Access rules" of "ProjectFramework" depending project.

    Click Edit....

    Edit Required Project Access Rules

  16. In Type Access Rules, click Add....

    Type Access Rules dialog

  17. In Add Access Rule, select "Forbidden" for Resolution.

    Type "**/forbidden/**" in Rule Pattern field.

    Add Access Rule dialog

  18. Click OK to validate access rule and close dialog.

  19. Add another access rule:

    Resolution: "Discouraged" and Rule Pattern: "**/internal/**".

  20. Your access rules now look as follows:

    Type Access Rules final result

  21. Click OK to validate these new rules and close dialog.

  22. Dependent project has now 2 access rules set.

    VJET Project Required Projects final setup

  23. Click Finish.

  24. You now have a VJET project which contains the source of "Project" and which is using the source of "ProjectFramework".

    Some packages of the project "ProjectFramework" are restricted and if you try to import them, compiler displays either warnings or errors depending on your restriction level:

    Created VJET projects in Workspace

Related reference