]
Antonio Goncalves closed FORGE-2280.
------------------------------------
Resolution: Duplicate Issue
Being able to use ~ as the top level package root directory
-----------------------------------------------------------
Key: FORGE-2280
URL:
https://issues.jboss.org/browse/FORGE-2280
Project: Forge
Issue Type: Feature Request
Components: UI - Shell
Affects Versions: 2.15.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
In Forge 1.x there was this notion of project root (with {{~~}}) but also the top level
package root (with {{~}}). So we could write something like that :
{code}
new-project --named test --topLevelPackage com.mycomp.myproj
java new-class --named Test --package ~.constraints
Wrote com.mycomp.myproj.constraints.Test.java
{code}
With the {{--package ~.constraints}} paramater, it will create a class under
{{com.mycomp.myproj.constraints}} because {{~}} represents the top level package
{{com.mycomp.myproj}}.
This is not possible with Forge 2.x. The same code in Forge 2.x produces the following
exception :
{code}
project-new --named test --topLevelPackage com.mycomp.myproj
java-new-class --named Test --targetPackage ~.constraints
Exception when parsing/running: java-new-class --named Test6 --targetPackage
~.constraints, Invalid identifier : >~<
{code}
When writing Forge scripts, it's much easier and reusable to be able to use the {{~}}
represents the top level package.