You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Michael Fong <mc...@gmail.com> on 2017/09/23 10:45:04 UTC

Building scala examples

Hi,

I am studying how to build a scala program from flink-examples/.

I can see there are two source folders java/ and scala/ from IntelliJ, and
for most examples, there is a copy of examples for Java and Scala.
Executing 'mvn clean package -Pbuild-jar' would rests in a jar file under
target/. I am wondering if that is a Java or Scala example that I just
compiled? In addition, is there a way to selectively choose Java o Scala
example to build with current maven settings?

Thanks in advance,

Re: Building scala examples

Posted by Nico Kruber <ni...@data-artisans.com>.
Hi Michael,
yes, it seems that the self-contained jars only contain the Java examples.

You may also follow the quickstart [1] to get started writing Flink streaming 
programs in Scala.


Nico

[1] https://ci.apache.org/projects/flink/flink-docs-release-1.3/quickstart/
scala_api_quickstart.html

On Wednesday, 27 September 2017 05:04:31 CEST Michael Fong wrote:
> Thanks, Nico.
> 
> 
> I look again at flink-examples- streaming_2.10-1.4-SNAPSHOT.jar, and it
> indeed contains both.
> 
> Originally I was looking at each self-contained jars as I used them as
> examples to create and run my own streaming program. They only contain java
> compiled class, if I am not mistaken.
> 
> Let me try to create a scala example with similar build procedure.
> 
> Thanks!
> 
> 
> On Mon, Sep 25, 2017 at 10:41 PM, Nico Kruber <ni...@data-artisans.com>
> 
> wrote:
> > Hi Michael,
> > from what I see, Java and Scala examples reside in different packages,
> > e.g.
> > * org.apache.flink.streaming.scala.examples.async.AsyncIOExample vs.
> > * org.apache.flink.streaming.examples.async.AsyncIOExample
> > 
> > A quick run on the Flink 1.3. branch revealed flink-examples-
> > streaming_2.10-1.3-SNAPSHOT.jar containing both (which you can verify with
> > your favorite archiver tool for zip files).
> > 
> > Afaik, there is no simple switch to turn off Java or Scala examples. You
> > may
> > either adapt the pom.xml or create your own Project with the examples and
> > programming languages you need.
> > 
> > 
> > Nico
> > 
> > On Saturday, 23 September 2017 12:45:04 CEST Michael Fong wrote:
> > > Hi,
> > > 
> > > I am studying how to build a scala program from flink-examples/.
> > > 
> > > I can see there are two source folders java/ and scala/ from IntelliJ,
> > 
> > and
> > 
> > > for most examples, there is a copy of examples for Java and Scala.
> > > Executing 'mvn clean package -Pbuild-jar' would rests in a jar file
> > > under
> > > target/. I am wondering if that is a Java or Scala example that I just
> > > compiled? In addition, is there a way to selectively choose Java o Scala
> > > example to build with current maven settings?
> > > 
> > > Thanks in advance,



Re: Building scala examples

Posted by Michael Fong <mc...@gmail.com>.
Thanks, Nico.


I look again at flink-examples- streaming_2.10-1.4-SNAPSHOT.jar, and it
indeed contains both.

Originally I was looking at each self-contained jars as I used them as
examples to create and run my own streaming program. They only contain java
compiled class, if I am not mistaken.

Let me try to create a scala example with similar build procedure.

Thanks!


On Mon, Sep 25, 2017 at 10:41 PM, Nico Kruber <ni...@data-artisans.com>
wrote:

> Hi Michael,
> from what I see, Java and Scala examples reside in different packages, e.g.
> * org.apache.flink.streaming.scala.examples.async.AsyncIOExample vs.
> * org.apache.flink.streaming.examples.async.AsyncIOExample
>
> A quick run on the Flink 1.3. branch revealed flink-examples-
> streaming_2.10-1.3-SNAPSHOT.jar containing both (which you can verify with
> your favorite archiver tool for zip files).
>
> Afaik, there is no simple switch to turn off Java or Scala examples. You
> may
> either adapt the pom.xml or create your own Project with the examples and
> programming languages you need.
>
>
> Nico
>
>
> On Saturday, 23 September 2017 12:45:04 CEST Michael Fong wrote:
> > Hi,
> >
> > I am studying how to build a scala program from flink-examples/.
> >
> > I can see there are two source folders java/ and scala/ from IntelliJ,
> and
> > for most examples, there is a copy of examples for Java and Scala.
> > Executing 'mvn clean package -Pbuild-jar' would rests in a jar file under
> > target/. I am wondering if that is a Java or Scala example that I just
> > compiled? In addition, is there a way to selectively choose Java o Scala
> > example to build with current maven settings?
> >
> > Thanks in advance,
>
>
>

Re: Building scala examples

Posted by Nico Kruber <ni...@data-artisans.com>.
Hi Michael,
from what I see, Java and Scala examples reside in different packages, e.g.
* org.apache.flink.streaming.scala.examples.async.AsyncIOExample vs.
* org.apache.flink.streaming.examples.async.AsyncIOExample

A quick run on the Flink 1.3. branch revealed flink-examples-
streaming_2.10-1.3-SNAPSHOT.jar containing both (which you can verify with 
your favorite archiver tool for zip files).

Afaik, there is no simple switch to turn off Java or Scala examples. You may 
either adapt the pom.xml or create your own Project with the examples and 
programming languages you need.


Nico


On Saturday, 23 September 2017 12:45:04 CEST Michael Fong wrote:
> Hi,
> 
> I am studying how to build a scala program from flink-examples/.
> 
> I can see there are two source folders java/ and scala/ from IntelliJ, and
> for most examples, there is a copy of examples for Java and Scala.
> Executing 'mvn clean package -Pbuild-jar' would rests in a jar file under
> target/. I am wondering if that is a Java or Scala example that I just
> compiled? In addition, is there a way to selectively choose Java o Scala
> example to build with current maven settings?
> 
> Thanks in advance,