Need help with scalagen?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

timowest
210 Stars 32 Forks Apache License 2.0 167 Commits 21 Opened issues

Description

Java to Scala transformation

Services available

!
?

Need anything else?

Contributors list

# 29,035
Java
Shell
Scala
139 commits
# 218,987
Scala
Shell
CSS
javadoc
10 commits
# 73,260
vue-cli
vuetify
pico-8
entity-...
1 commit

Scalagen

Java to Scala conversion

Scalagen is a Java to Scala conversion tool. It uses a Java based parser for Java sources and provides modular transformation of the AST to match Scala idioms. The resulting transformed AST is serialized into Scala format.

Here is a list of example Java sources which have been successfully converted by Scalagen: https://github.com/mysema/scalagen/tree/master/scalagen/src/test/scala/com/mysema/examples

Scalagen has also been tested on our own projects such as Querydsl, RDFBean, Codegen and some customer projects.

Usage

Scalagen provides direct Maven support via a plugin. You can use it directly via the command line like this

mvn com.mysema.scalagen:scalagen-maven-plugin:0.2.2:main -DtargetFolder=target/scala

and for test sources

mvn com.mysema.scalagen:scalagen-maven-plugin:0.2.2:test -DtargetFolder=target/scala

Here is the snippet for an explicit configuration in a POM:

  com.mysema.scalagen
  scalagen-maven-plugin
  0.2.2

To convert main sources run

mvn scalagen:main

and to convert test sources run

mvn scalagen:test

The conversion results are to be seen as a starting point for the Java to Scala conversion. Some elements are not transformed correctly for various reasons and will need manual intervention.

Development

Scalagen development instructions are here https://github.com/mysema/scalagen/wiki/Scalagen-development

Building

To create the jar run

mvn -Pscala-2.11.x clean package

To import the project in to eclipse run

mvn -Pscala-2.11.x eclipse:eclipse

The maven profiles (the part after the

-P
) can be:
  • scala-2.11.x
  • scala-2.10.x
  • scala-2.9.x

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.