Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to build maven Project

Shulou Source: shulou.com Published: 2022-06-02 05:24:53 10月03日 Update

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!

Tags: Project content plug-in more version catalog knowledge run practical learned next command dilemma reality situation article case structure result tape Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information vpn NVidia MySQL