Create and test a simple Java project with Maven and Intellij
How to create and test a simple Java project with Maven and Intellij.
Step 1
Use maven to create the project skeleton.
Either
mvn archetype:generate
and pick Option 15 – maven-archetype-quickstart
Or
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
-DgroupId=net.olioinfo \
-DartifactId=java_simple \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeGroupId=org.apache.maven.archetypes
Step 2
- Import into Intellij as a Maven project.
- Make sure that the SDK is set to a JAVA SDK
- On the Run menu, edit the Configurations to add a Junit test suite
- Select ‘Test all in package’
- Specify package
- Pick the top-level project directory as the working directory
- Ensure that ‘Make’ and ‘Build artifacts’ are checked
- Save
- The top two entries on the Run menu are now available
- The top ‘Run’ menu entry will run the last configuration applied
- The top ‘Debug’ menu entry will debug the last configuration applied
- Maven introduces two more entries below the top two entries on the Run menu
- ‘Run’ will run the configured maven goal (from the last configuration applied).
- ‘Debug’ should run maven in debug mode. Doesn’t seem to work
- All the standard maven targets work from command line. They will also function when included in an Intellij run-time configuration.
No Comments
No comments yet.
RSS feed for comments on this post. TrackBack URI
Leave a comment
You must be logged in to post a comment.