Skip to main content



      Home
Home » Modeling » Papyrus » Help generating java code in Papyrus.
Help generating java code in Papyrus. [message #1858361] Thu, 30 March 2023 13:08 Go to next message
Eclipse UserFriend
Hi, i have downloaded recently:
https://www.eclipse.org/papyrus/download.html

latest RCP 2023-03 release (6.4.0) - Includes Java 11 JustJ JRE

So i uncompressed and run Papyrus....

1 - So is there all the Eclipse libraries and things that i need with a complete Papyrus installation, or should i add more plugins. All documentation i have read refers to Eclipse "standard" version or to Mars version, not to the Papyrus version.

2 - Once inside, i create a new papyrus project, with a diagram class, but i cant find any profile java code generator ( even c++), and i cant get the code generation. How can i generate code in java ? Do i have to install anything else ?

Any help would be apreciated, as im a teacher and im using papyrus in my class of uml.

Thanks
Re: Help generating java code in Papyrus. [message #1858363 is a reply to message #1858361] Thu, 30 March 2023 13:30 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Java functionality from Papyrus is part of the standard Papyrus (for structural UML). The exploitation of the OCL2Java CG should also be standard supporting constraints, and expressions. If you want 'full' UML such as State machines you need something more, perhaps Moka; sorry beyond my knowledge.

Support for C++ requires an additional install.

Regards

Ed Willink
Re: Help generating java code in Papyrus. [message #1858364 is a reply to message #1858363] Thu, 30 March 2023 13:42 Go to previous messageGo to next message
Eclipse UserFriend
So im not able to generate java code from a diagram class, can you make a tutorial or what options or profiles to use ??

By now im only interested in java.

I create a class diagram with imported registered package Java Primitives Type ( which actually i consider very poor with only few types), but i can find any option/configuration to generate the code....
In previous papyrus versions, you went to papyrus model, with button right you get to Designer and then Generate Code Java....but i dont find any location or place to generate the code.

Any help would be apreciated


Re: Help generating java code in Papyrus. [message #1858367 is a reply to message #1858364] Fri, 31 March 2023 00:48 Go to previous messageGo to next message
Eclipse UserFriend
We seem to have a misunderstanding.

I wrote that generation of Java from structural UML, which is what a class diagram normally requires, is built-in. Papyrus provides the relevant wizard to drive the UML2Ecore and Ecore2Java conversions.

You should not need more tutorials. They already exist.
Re: Help generating java code in Papyrus. [message #1858368 is a reply to message #1858367] Fri, 31 March 2023 03:49 Go to previous messageGo to next message
Eclipse UserFriend
Can you put a link ? the tutorials i seen are from Mars Version of Eclipse and didnt work....
There is any option to generate code from diagram class.
I have re-reading many times the menus and config options in all places...
Thanks
Re: Help generating java code in Papyrus. [message #1858392 is a reply to message #1858368] Fri, 31 March 2023 11:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

the remark of Ed refers to Ecore2Java which is a specific code generator for meta-models.

If you want to generate Java application code from a class diagram, you should install the Papyrus extension Software Designer.
Re: Help generating java code in Papyrus. [message #1858393 is a reply to message #1858392] Fri, 31 March 2023 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Im trying to install from Marketplace, Papyrus Designer Software Designer from 2.1.0:
Im facing this problem: Cannot complete the provisioning operation. Please change your selection and try again. See below for details.

index.php/fa/43074/0/

index.php/fa/43075/0/

Details:
Cannot complete the install because some dependencies are not satisfiable
Software being installed: Papyrus Java profile, library and code generation 2.1.0.202202061747 (org.eclipse.papyrus.designer.languages.java.feature.feature.group 2.1.0.202202061747)
Software currently installed: Papyrus 6.4.0.202303200916 (org.eclipse.papyrus.rcp.product 6.4.0.202303200916)
Cannot satisfy dependency:
From: JustJ Adoptium OpenJDK Hotspot JRE Complete 11.0.18.v20230129-1042 (org.eclipse.justj.openjdk.hotspot.jre.full 11.0.18.v20230129-1042)
To: org.eclipse.equinox.p2.iu; a.jre.javase 0.0.0
Cannot satisfy dependency:
From: JustJ Adoptium OpenJDK Hotspot JRE Complete 11.0.18.v20230129-1042 (org.eclipse.justj.openjdk.hotspot.jre.full.feature.group 11.0.18.v20230129-1042)
To: org.eclipse.equinox.p2.iu; org.eclipse.justj.openjdk.hotspot.jre.full [11.0.18.v20230129-1042,11.0.18.v20230129-1042]
Cannot satisfy dependency:
From: M2E Maven Integration for Eclipse UI 2.0.4.20230305-1928 (org.eclipse.m2e.core.ui 2.0.4.20230305-1928)
To: osgi.ee; (&(osgi.ee=JavaSE)(version=17))
Cannot satisfy dependency:
From: Papyrus Java profile, library and code generation 2.1.0.202202061747 (org.eclipse.papyrus.designer.languages.java.feature.feature.group 2.1.0.202202061747)
To: org.eclipse.equinox.p2.iu; org.eclipse.papyrus.designer.languages.java.jdt.project [2.1.0.202202061747,2.1.0.202202061747]
Cannot satisfy dependency:
From: Papyrus Designer JDT support 2.1.0.202202061747 (org.eclipse.papyrus.designer.languages.java.jdt.project 2.1.0.202202061747)
To: osgi.bundle; org.eclipse.m2e.core.ui 1.7.0
Cannot satisfy dependency:
From: Papyrus 6.4.0.202303200916 (org.eclipse.papyrus.rcp.product 6.4.0.202303200916)
To: org.eclipse.equinox.p2.iu; org.eclipse.justj.openjdk.hotspot.jre.full.feature.group [11.0.18.v20230129-1042,11.0.18.v20230129-1042]

[Updated on: Fri, 31 March 2023 11:39] by Moderator

Re: Help generating java code in Papyrus. [message #1858400 is a reply to message #1858393] Fri, 31 March 2023 13:52 Go to previous messageGo to next message
Eclipse UserFriend
Apparently, the issue is related to your JVM. When SW Designer is installed, it also tries to install the C++ development tools (CDT), even if you only install the Java feature. As the current version of CDT needs Java-17, this fails if your Eclipse only ships with a Java-11 JVM.
There are two options: either install a newer JVM or use the nightly update site of Designer. Some dependencies have been cleaned up since the release and it does not require CDT, if you only define Java features.
Re: Help generating java code in Papyrus. [message #1858402 is a reply to message #1858400] Fri, 31 March 2023 16:18 Go to previous messageGo to next message
Eclipse UserFriend
Actually is too difficult to work with Papyrus from the official page, i have installed papyrus nightly build aka 6.5.0 and designer i got 3.0 from this place: https://ci.eclipse.org/papyrus/job/papyrus-designer-2022-06/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.designer.p2/target/repository/
which was took from https://ci.eclipse.org/papyrus/view/Designer/.

Still doesnt work...with ubuntu 22.04 with latest updates.

Should be in next days a papyurs download 6.5.0 or something like that with this errors corrected, with the jre needed included and ideally with java, c++ code generators in a single easy to use software ?
Re: Help generating java code in Papyrus. [message #1858403 is a reply to message #1858402] Fri, 31 March 2023 16:36 Go to previous messageGo to next message
Eclipse UserFriend
The easiest option should be to install an RCP from https://ci.eclipse.org/papyrus/job/papyrus-designer-2021-12/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.designer.product/target/products/
I'll check next week, whether I can reproduce the installation issues.
Re: Help generating java code in Papyrus. [message #1858406 is a reply to message #1858403] Sat, 01 April 2023 05:43 Go to previous messageGo to next message
Eclipse UserFriend
Hi, thanks for your help.

1 - As your link is from yesterdy 31-03-2023

org.eclipse.papyrus.designer.product-linux.gtk.x86_64.tar.gz 31 mar. 2023 20:44:45 508.15 MB
org.eclipse.papyrus.designer.product-macosx.cocoa.x86_64.tar.gz 31 mar. 2023 20:45:24 505.44 MB
org.eclipse.papyrus.designer.product-win32.win32.x86_64.zip 31 mar. 2023 20:44:04 510.09 MB

I downloaded the linux version, but although release date was yesterday, the papyrus UML version that uses seems old 3.3.0 ( as latest version released is 6.4.0 and nightly builds are releasing 6.5.0)

As said before would be nice to release a Papyrus ( lstest version, perhaps 6.50) + UML designer + Java Generator ( possibly c++ and pytbhon) + jre 17 ( or compatible version) in a single zip

If you can you can make a teamviewer or meet session, but my english is very poor, but you cant see what errors come from.

[Updated on: Sat, 01 April 2023 05:44] by Moderator

Re: Help generating java code in Papyrus. [message #1858431 is a reply to message #1858406] Mon, 03 April 2023 03:43 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I could reproduce the problem to install only the Java code generation. The reason is that not only CDT, but also JDT needs Java 17 since some time. As the nightly RCP build use indeed an relatively old target (2021-21), I switched it to 2023-03 and also moved the embedded JustJ VM to Java 17. I've updated the installation instructions on the WIKI page accordingly. You can now get an RCP from here: https://ci.eclipse.org/papyrus/job/papyrus-designer-2023-03/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.designer.product/target/products/
I realized that the nightly still contains the release update site of Designer in the pre-installed update-sites. This should be changed to the nightly update site. I'll fix that in the next days, but this is only relevant if you install Designer updates. The Java code generation feature is already installed in the RCP.
Re: Help generating java code in Papyrus. [message #1858441 is a reply to message #1858431] Mon, 03 April 2023 06:18 Go to previous messageGo to next message
Eclipse UserFriend
Nice to hear about that...

1 - Can you put a link to the wiki for installation instructions ?
2 - Whats the difference between official papyrus release and RCP ??

3 - Ive been testing with the link you provided: and do i have to install from marketplace or other site any additional software ( Papyrus UML, Papyrus Designer, Papyrus SYsml..)

4 - Then I created a new papyrus project, so i dont know which profile to add Java Code Profile or Papyrus Code Generation, as i guess i can only insert or add one profile.

index.php/fa/43078/0/


Thanks

[Updated on: Mon, 03 April 2023 06:29] by Moderator

Re: Help generating java code in Papyrus. [message #1858501 is a reply to message #1858441] Wed, 05 April 2023 04:51 Go to previous messageGo to next message
Eclipse UserFriend
Eduardo,

Papyrus itself follows the Eclipse release train, i.e. there is a quarterly release. The binaries are part of the update-site corresponding to the Eclipse release. In addition to that, the Papyrus team produces a ready-to use Eclipse-installation in which Papyrus has already been installed, the RCP.

Papyrus SW designer is an extension of Papyrus. It does not follow the release train, releases are less frequent. It also provides an RCP for convenience.

I was talking about the wiki pages with the installation instructions.

Seeing your questions, I realized that a simple getting-started example for Java was missing. This will be added in the context of bug 581773 and can afterwards be installed via "File->New example". I attach it here (copy it into an existing project)

SW Designer uses a generic code generation profile to provide information about the generator to use. In addition, it is useful to apply a specific profile for the used programming language and the standard profile. The former has concepts that are not available in standard UML, e.g. pointers in case of C/C++ or synchronized methods in case of Java, the latter the stereotypes create/destroy that denote constructors/destructors.

[Updated on: Wed, 05 April 2023 05:57] by Moderator

Re: Help generating java code in Papyrus. [message #1858502 is a reply to message #1858501] Wed, 05 April 2023 05:09 Go to previous messageGo to next message
Eclipse UserFriend
??
Re: Help generating java code in Papyrus. [message #1858513 is a reply to message #1858502] Wed, 05 April 2023 10:27 Go to previous messageGo to next message
Eclipse UserFriend
Can you tell me, which part of my response was not clear? I suggest, you simply unzip the attached model file, copy it into a project of your workspace and invoke code generation via a right click in the model explorer (Designer->Generate code) and examine the generated code.
Re: Help generating java code in Papyrus. [message #1858529 is a reply to message #1858513] Thu, 06 April 2023 05:05 Go to previous messageGo to next message
Eclipse UserFriend
Sorry i put ?? because i wasnt able to read your response.
Ive been testing your latest relaease: https://ci.eclipse.org/papyrus/job/papyrus-designer-2023-03/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.designer.product/target/products/ from 5 April.

"good things": Seems it has papyrus uml 6.4.0 and papyrus designer 2.1.0 ( as i can read you use nightly builds 3.0 with java code generator items).

I thank you for your effort and help, and organize this kind of mess ( at least for me) of versions of Eclipse, Papyrus, Java, Papyrus for UML and Papyrus Software Designer...)

My questions are:
1 - What profile to add to the project: the Papyrus code generation Profile or Papyrus Java profile ( or c++ Profile if i need it).. or more than one profile...To be honest i dont understand what a profile registered/profile mean... You can watch screenshots in previous post to make it clearer.

2 - Seems that with your link RCP comes Papyrus Software Designer 2.1.0 installed in market place. Do or is recommended to install also Papyrus SYUML 1.6 2.2.0 ? .

3 - Also is recommended to install Papyrus Model-Doc 0.8.0 ?

4 - When i create the code, i have to create also a JDT java project. Wouldnt be clearer to put code in same project ( perhaps in a folder called code or src or something like that) and not creating another Java project ?

Thanks

[Updated on: Thu, 06 April 2023 05:37] by Moderator

Re: Help generating java code in Papyrus. [message #1858532 is a reply to message #1858529] Thu, 06 April 2023 05:45 Go to previous messageGo to next message
Eclipse UserFriend
The profiles to add depend on what you want to do. You sometimes need a stereotype to refine the code generation. For instance, the Java code generation for an UML operation will not add the synchronized keyword, unless you apply the stereotype <<Synchronized>> from the Java profile. If you want to add a constructor or destructor, you need to apply the standard profile.
The common profile chiefly stores the generator to use. If it is not applied, the code generation dialog automatically applies it in order to save the information about the used generator - in most cases, you don't need to bother with it. It is also used for some programming language independent mechanisms such as template bindings.

You will not have a Designer 2.1.0 with Papyrus 6.5.0/Java 17, but you have a nightly SW designer 3.0.0 build offering Eclipse 2023-03 + Papyrus 6.4.0. Update-site and RCPs are available from continuous integration. It is also quite likely that I will release 3.0.0 in the next days.
Re: Help generating java code in Papyrus. [message #1858533 is a reply to message #1858532] Thu, 06 April 2023 07:17 Go to previous messageGo to next message
Eclipse UserFriend
You are the programmer for papyrus uml, papyrus designer and code genratror arent you ?

I think a java code generator have to have constructor/s and getter and setters. Destructor is not so necessary in my opinion.

So, sorry but as yu have noticed english is not my mother language....

1 - I can expect in some days the release of nightly builds ive been using. with designer 2.1.0 + eclipse 2023-03 + java17 + payrus 6.4.0

2 - When can i expect designer 3.0+ papyrus 6.5.0 + eclipse 2023-03+java ?

3 - So you recommend the Java Profile instead the Papyrus "general" code generator isnt it ? Id have to import registered profile: called "Java PapyrusProfile" and also the registered package called Java Primitives Types ?? This would be a goog general/average config to begin to work ?

Thanks again
Re: Help generating java code in Papyrus. [message #1858544 is a reply to message #1858533] Thu, 06 April 2023 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Papyrus is the result of many developers. While I contribute sometimes to Papyrus itself, I'm mainly developing Papyrus SW designer, but there are other contributors as well.

I'm not recommending to apply the Java profile instead of the general code generation one. I only said that SW designer applies the general one automatically, if it stores your decision which generator to use.
In the moment, I recommend to use the nightly (pre-) 3.0.0 build, I don't have a fixed date for the 3.0.0 release.
Re: Help generating java code in Papyrus. [message #1858547 is a reply to message #1858544] Thu, 06 April 2023 13:50 Go to previous messageGo to next message
Eclipse UserFriend
Sorry but as i understood you recommend indirectly to use the Papyrus Java Profile, as the Papyrus Code Generation Profile is included in Software Designer. So it has no sense to add a profile already loaded.

1 - Wouldnt be easier to add all the things in Sofware Designer in Papyrus Code Generation Profile and avoid adding other profiles or packages.
2 - Ok but you said that probably next days we can have a sw 2.1.0 with papyrus 6.4.0 + eclipse 23 + java 17.... Am i right ? It could take then some more days or weeks the version with Software Designer 3.0 + Papyrus UML 6.5.0 --.
3 - Also i suggest not to create another java project to generate java code. Only a suggestion some other software does this way...i think is easier.

Thanks again

Re: Help generating java code in Papyrus. [message #1858558 is a reply to message #1858547] Fri, 07 April 2023 04:20 Go to previous messageGo to next message
Eclipse UserFriend
1. It is useful to have separate profiles as each programming language has different specific concepts, for instance you have the "friend" concept in C++ but not in Java. Having all stereotypes in a single profile would be confusing, since the tool would allow to apply a stereotype that is not supported by the target programming language.

2. I said that you would not have 2.1.0 with current Papyrus versions.

3. Yes,, it might be preferable not to create a separate project and to put the generated code into the project hosting the model. We do that in Papyrus for Robotics.
Re: Help generating java code in Papyrus. [message #1858561 is a reply to message #1858558] Fri, 07 April 2023 05:12 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your effort and help...


About 2: Seems that nightly build has papyrus 6.4.0 and sofware designer 3.0 as this screenshot shows:

index.php/fa/43089/0/

But in the other side seems you have the Papyrus software designer 2.1.0 from marketplace:

index.php/fa/43090/0/

Perhaps it shows this, but really it has inside the 3.0 version...

4 - By the way its useful or what incorporates the Papayrus SysUML 1.6.2, it adds something or its included in Papyrus for UML ?

[Updated on: Fri, 07 April 2023 05:18] by Moderator

Re: Help generating java code in Papyrus. [message #1858644 is a reply to message #1858561] Thu, 13 April 2023 07:27 Go to previous message
Eclipse UserFriend
SysML is not included in the Papyrus base distribution nor in Papyrus SW Designer. If you need SysML, you can either start with a SysML installation (which evidently includes Papyrus) or install Papyrus or SW designer first and then add SysML.
Previous Topic:Suddenly Have No Model in the Explorer?
Next Topic:papyrus-sysml block's 'value' is lost
Goto Forum:
  


Current Time: Sun May 11 23:26:43 EDT 2025

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

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

Back to the top