How to build the project in Apache Flink core? - apache-flink

I'm beginner in Apache Flink and can't find any information about extending Flink core. I want start with simple: to build in one test-class. should I save that class as jar-file somewhere in flink?

I recently started developing small programs with Apache Flink, so I had the same problem. I advise you to use maven because it will allow to link all the dependencies you need and easily build your own classes.
You need to first install maven and then you can create a Flink Maven project with the following command:
mvn archetype:generate -DarchetypeGroupId=org.apache.flink -DarchetypeArtifactId=flink-quickstart-java -DarchetypeVersion=1.0.2
after that can add your classes to the src/main/java/[GroupId]../ and compile them with:
mvn package
Then, to run you newly created program you can execute the following command:
mvn exec:java -Dexec.mainClass="Package.YourClass" -Dexec.args="YOUR PROGRAM ARGUMENTS"
There are also tutorials all over the internet of how to run maven with an IDE if you want to.

Related

Flink: Error while running the flink program on CLI

I am trying to run a flink steaming program that uses kafka connector(latest universal connector).
The jobs runs without any problem on IntelliJ but when I am submitting the code build into jar using sbt package is giving me below error.
java.lang.ClassNotFoundException: org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumerBase
I also used the jar built using traditional IntellIJ option but still i get the above error.
Most probably the issue is the fact that You are not including the dependencies in Your JAR file. Connector dependencies are not included in the Flink binary.
Generally, the preferred way of tackling this issue is to use the proper plugin for Your build tool like shade-plugin for Maven or assembly for sbt to create so-called fat-jar i.e. the JAR with the dependencies included.

How to package and deploy Grails 3.3.2 Angular project in tomcat

I created sample Grails Angular project. When I run a gradlew war it packages only server-side code, its not adding the client-side code. What is the proper way to package and deploy this project?
./gradlew war
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
:server:compileJava NO-SOURCE
:server:compileGroovy UP-TO-DATE
:server:buildProperties UP-TO-DATE
:server:processResources
:server:classes
:server:compileGsonViews
:server:war
BUILD SUCCESSFUL
Total time: 17.307 secs
The main benefit of having separate projects (client/server) is the ability to deploy them separately. If you want to deploy them together, then they should be in the same project. See this guide on how to merge them together.
http://guides.grails.org/angular2-combined/guide/index.html

Jenkins pipeline Incremental build(maven)

Does anybody know how to get feature "Incremental build - only build changed modules" from Maven Project Plugin available from inside jenkins declarative pipeline (Jenkinsfile)

How can I update my Flink version programmatically

At the moment I have Flink 0.8.1 installed on my machine. I installed it via Maven and would like to know how I can update it. Do I have to deinstall everything in order to update to the current version? Or can I do it via Maven?
If you have a Maven project which depends on Apache Flink you can simply update the version of the Flink dependencies in your project's pom.xml file. Just run mvn clean compile again and Maven will fetch all required dependencies.
The old dependencies will remain in your local Maven repository (~/.m2/repository/). You can "uninstall" the old Flink dependencies by deleting the corresponding jar files.

Maven repository for java.nio

I am writing an application in Java 6 (I have to stick with this).
I need to write a module for file watcher.
After googling around, I found that Java 7 java.nio package is good.
I want to import this sub package alone to maven [my repository] and create the module.
Can any one guide me how can i achieve this? is there any maven repo for such sub-modules?
All the java.nio packages are part of the rt.jar of the basic JRE. So they are not present in any other Maven package, since they assume you already have it.
If you want to use NIO from Java 7, you could package and deploy all or part of the rt.jar as a Maven module onto your own repo, but I wouldn't recommend it.
You can add this:
compile group: 'com.jtransc', name: 'jtransc-rt', version: '0.3.1'

Resources