Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Problems with java:package
Problems with java:package [message #51340] Wed, 01 October 2008 14:49 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hey again,

I've founded an interesting thing out about the java:package construct. In
my template, i have the following iteration wihtin an UML class model:

<c:iterate select="$model//Package[count(child::Class) > 0 or
count(child::Interface) > 0 ]" var="ePackage">

that works fine. Actually, only the Packages, that includes either a class
or an interface are traversed. But know, i want to create packages out of
it. Therefor i use the structure:

<c:iterate select="$model//Package[count(child::Class) > 0 or
count(child::Interface) > 0 ]" var="ePackage">
<java:package name="{computePackageHierarchy($ePackage)}"> //
reports a qualified name,e.g. core.sub1.sub2 -> works correct!
...
</java:package>
</c:iterate>

The related output is generated but only the first level packages are
treated as packages in the project. The output is directly generated into a
Java-Project Source Folder. But compilation errors are shown, because the
subpackages won't be treated as those. Is this a bug?

The same behviour occurs, when i generated teh output via ws:folder and
ws:file and declaring the root folder afterwards as a SourceFolder.
Timothy
Re: Problems with java:package [message #51481 is a reply to message #51340] Wed, 01 October 2008 18:22 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Timothy:

Something sounds out of sorts. I'll take a look (but it may take a day or
two).

Paul
Re: Problems with java:package [message #51764 is a reply to message #51340] Mon, 06 October 2008 14:08 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Timothy:

I'm having trouble reproducing this. But, in general, for the java:* classes
to work correctly, the Java project must be correctly configured. And, if
you are creating the Java project as part of you transformation, you must
create the source folder, and all the configuration files (.project and
..classpath being the minimum) BEFORE you use java:package.

Here's my test case, the works just fine on my machine.

<ws:project name="my.java">
<ws:file path=".project" template="templates/my.java/project.jet"/>
<ws:file path=".classpath" template="templates/my.java/classpath.jet"/>
<ws:folder path="src"/>
</ws:project>

<java:package name="com.ibm" srcFolder="my.java/src">
</java:package>
<java:package name="com.ibm.otherchild" srcFolder="my.java/src">
</java:package>

It works whether or not my.java exists. The contents of the project.jet and
classpath.jet templates are simply renamed versions of the .project and
..classpath files from a hand create project called my.java. In the real
world (where you generated projects whose name is variable), you need to
parameterize the project.jet template with the target project's name. And,
of you want to parameterize the java source folder, its found in the
..classpath file.

How, structurally, does your code differ from my test case?

Paul
Re: Problems with java:package [message #51898 is a reply to message #51764] Tue, 07 October 2008 10:06 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Paul,

with the hint to create all meta-information for the project before the
package generation, it works as it should be with any dpeth of the package
hierarchy.
My scenario was similar, in fact, i've created a Java project at first and
generated all the files into the existing project, by using the predefined
variable for the context project name.

Thx
Timothy

"Paul Elder" <pelder@ca.ibm.com> schrieb im Newsbeitrag
news:gcd65a$6be$1@build.eclipse.org...
> Timothy:
>
> I'm having trouble reproducing this. But, in general, for the java:*
> classes to work correctly, the Java project must be correctly configured.
> And, if you are creating the Java project as part of you transformation,
> you must create the source folder, and all the configuration files
> (.project and .classpath being the minimum) BEFORE you use java:package.
>
> Here's my test case, the works just fine on my machine.
>
> <ws:project name="my.java">
> <ws:file path=".project" template="templates/my.java/project.jet"/>
> <ws:file path=".classpath" template="templates/my.java/classpath.jet"/>
> <ws:folder path="src"/>
> </ws:project>
>
> <java:package name="com.ibm" srcFolder="my.java/src">
> </java:package>
> <java:package name="com.ibm.otherchild" srcFolder="my.java/src">
> </java:package>
>
> It works whether or not my.java exists. The contents of the project.jet
> and classpath.jet templates are simply renamed versions of the .project
> and .classpath files from a hand create project called my.java. In the
> real world (where you generated projects whose name is variable), you need
> to parameterize the project.jet template with the target project's name.
> And, of you want to parameterize the java source folder, its found in the
> .classpath file.
>
> How, structurally, does your code differ from my test case?
>
> Paul
>
Previous Topic:JET var in scriptlets
Next Topic:JET tag to set local variable - Flag
Goto Forum:
  


Current Time: Thu Dec 26 11:34:05 GMT 2024

Powered by FUDForum. Page generated in 0.03571 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top