Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build maven Project

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to build a maven project". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1, requirement

Maven version 3.0.4 and above

Java 7.x and above

2. Build the maven project

Mvn archetype:generate\

-DarchetypeGroupId=org.apache.flink\

-DarchetypeArtifactId=flink-quickstart-scala\

-DarchetypeVersion=1.3.2

Allows you to rename your project. After executing this command, you need to enter groupId, artifactId, and package name.

3, check the imported project

You can view the project directory structure under the generated directory

You can import the maven project into your IDE editor. For Eclipse, you need the following plug-ins, which can be installed online.

1), Eclipse 4.x

A) Scala IDE: http://download.scala-ide.org/sdk/lithium/e44/scala211/stable/site

B) m2eclipse-scala: http://alchim31.free.fr/m2e-scala/update-site

C) BuildHelper Maven Plugin:

Https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-buildhelper/0.15.0/N/0.15.0.201207090124/

2), Eclipse 3.8

A) Scala IDE for Scala 2.11:

Http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site

Scala IDE for Scala 2.10:

Http://download.scala-ide.org/sdk/helium/e38/scala210/stable/site

B) m2eclipse-scala:

Http://alchim31.free.fr/m2e-scala/update-site

C) Build Helper Maven Plugin

Https://repository.sonatype.org/content/repositories/forge-sites/m2e-extras/0.14.0/N/0.14.0.201109282148/

IntelliJ IDE can be imported directly into the maven project, and then the scala plug-in can be introduced.

4, run the test

Wave tip is used to use idea as. After importing the project, you can see

Object WordCount {

Def main (args: Array [String]) {

/ / set up the execution environment

Val env = ExecutionEnvironment.getExecutionEnvironment

/ / get input data

Val text = env.fromElements ("To be, or not to be,--that is the question:--"

"Whether 'tis nobler in the mind to suffer", "The slings and arrows of outrageous fortune"

"Or to take arms against a sea of troubles,")

Val counts = text.flatMap {_ .toLowerCase.split ("\\ W+")}

.map {(_, 1)}

.groupBy (0)

.sum (1)

/ / execute and print result

Counts.print ()

}

}

It can be run directly in idea, and the execution result is as follows:

This is the end of "how to build the maven Project". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report