Hello World from OSS Silicon Valley
HowToUse/Maven/3.2
_ Install&Setup
_ Command Line
- Prerequisite
- JDK is installed.
- Eclipse installation (You can refer HowToUse/Eclipse/4.3)
- Step.1
- Download Maven from http://maven.apache.org/download.cgi and unzip it.
(In case download file is tar ball)
$ tar xzvf <download file>
- Step.2
- Set path.
(In case you are using Windows)
The setting of "MAVEN_HOME" is not mandatory. Just I prefer to set "HOME" variable to manage multiple versions' path.
Item Description Example MAVEN_HOME Maven Home path "C:\apache-maven-3.2.2" Path Maven executable path "%MAVEN_HOME%\bin"
- Step.3
- Confirm if the maven works
$ mvn --version
_ Eclipse Plugin
(If you installed Eclipse for Java EE, Maven plugin, m2e is installed by default. Here, I use Eclipse 4.3 (Kepler) for explanation.)
- Step.1
- Launch eclipse.
- Step.2
- Choose "Help" -> "About Eclipse" and check if the plugin for Maven (m2e) has already been installed. If the icon for m2e is shown up, you have plugin.
- Step.3
- Choose "Help" -> "Install New Software" and click "add" button.
- Step.4
- Enter the name and location of plugin.
Parameter | Value | Example |
Name | Name for plugin | "m2e" |
Location | The location of plugin | "http://download.eclipse.org/technology/m2e/releases " |
- Step.5
- Check the install item and click "next" button.
_ HowToUse
_ Simple Case
- Step.1
- Create a new project.
$ mvn archetype:create \ -DgroupId=<Group ID> \ -DartifactId=<Artifact ID>
Argument Description Example archetype ArcheType "create" group ID Java Package name "org.apache" artifact ID Project name for Maven "project1"
- Step.2
- Launch eclipse and choose "File" -> "Import". Select "Existing Maven Project" and click "Next" button.
- Step.3
- Click "Browze" button.
- Step.4
- Select Maven project folder we have created.
- Step.5
- pom.xml in the folder will be recognized. Click "finish" button.
- Step.6
- Double click the pom.xml and edit it as needed. If you append "dependency" block, maven download correspondent library from maven repository and link the source code in the project.
(Example: Selenium plugin)
<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>LATEST</version> </dependency>
(MySQL Connector)
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.28</version> </dependency>
(Log4J)
<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.15</version> </dependency>
- Step.7
- Create test code.
- Step.8
- Compile project
$ mvn compile
- Step.9
- Execute Test Code
(Command line)
$ mvn test
(Eclipse) Choose "Run" -> "Run As" -> "maven test"
_ JavaEE project
(TBD)
_ Author
S.Yatsuzuka
Attach file:
SimpleCase_fig5.png 255 download
[Information]
SimpleCase_fig4.png 203 download
[Information]
SimpleCase_fig3.png 214 download
[Information]
SimpleCase_fig6.png 222 download
[Information]
SimpleCase_fig7.png 222 download
[Information]
SimpleCase_fig9.png 213 download
[Information]
SimpleCase_fig8.png 256 download
[Information]
SimpleCase_fig2.png 199 download
[Information]
SimpleCase_fig1.png 226 download
[Information]
CreateProject_fig1.png 111 download
[Information]
Install_fig2.png 219 download
[Information]
Install_fig3.png 206 download
[Information]
Install_fig4.png 217 download
[Information]
Install_fig6.png 233 download
[Information]
Install_fig5.png 210 download
[Information]
Install_fig1.png 212 download
[Information]
















Last-modified: 2015-08-17 (Mon) 02:41:34 (3476d)