Talking about what I did in the hugh company was Enterprise Applicationi Development, but what most we did was building or managing the package dependency manually. So we need to work out a way to aotomize them.
First of all, we need to figure what out maven is and how we configurate Maven, according to the rich information from Google, I don't want to say here. So we move forward to the very simple practice for the Maven 2.
Another reminder, please use maven 2.0.7 as different Maven Version may have different behavior... BTW, use Eclipse 3.3 for the investigation purpose.
1. Simple Pure Java Project. (Classic Hello World)
1.1 Command to create the Simple Java Skeleton, it can be used in any Java development tool.
c:\tutorials>mvn archetype:create -DgroupId=com.mytutorial -DartifactId=simple
1.2 Add eclipse support for the project above.
As Eclipse has its own program structure and files, we could also apply the structure or the files ourselve. But a eclipse plug-in for Maven help to do so:
C:\tutorials\simple>mvn eclipse:eclipse
After running that command, a Eclipse Java Based folder structure would be created.
1.3 The Best Practices is diffenciate the source folder and the development folder. So we need to import the source our workspace.
1.3.1 Add the class path variables
M2_REPO = c:\java\.m2\repository (in my case)
You could also try
mvn -Declipse.workspace=C:\java\eclipse-tutorial-workspace eclipse:addmaven-repo
To do so, but my environment did not accept this command.
1.3.2 Import a Java Project
In the Eclipse UI, import the source as
Existing Projects into Workspace.
1.3.3 Run the hello world
Right Click src/main/java/com.mytutorial/App.java then run.
src/test/java/com.mytutorial.AppTest.java would be the JUnit tester.
1.4 Generate a Jar for later use.
C:\tutorials\simple>mvn clean package
1.4.1 Finally, run the jar package:
C:\tutorials\simple>java -cp .\target\simple-1.0-SNAPSHOT.jar com.mytutorial.App
分享到:
相关推荐
Maven通过插件扩展其功能,如`maven-compiler-plugin`用于编译Java代码,`maven-surefire-plugin`用于运行测试。插件配置在`<build><plugins>`或`<reporting><plugins>`元素中。 ### 总结 Maven简化了Java项目的...
1. https://repo1.maven.org/maven2/mysql/mysql-connector-java/ 2. https://cdn.mysql.com//archives/mysql-connector-java-8.0/mysql-connector-java-8.0.28.zip 3. ...
解决 Maven 无法下载 fastdfs-client-java-1.29-SNAPSHOT 依赖,直接下载之后用maven命令存储到本地maven仓库即可。 maven命令 mvn install:install-file -DgroupId=org.csource -DartifactId=fastdfs-client-java ...
java maven 仓库包 pentaho-aggdesigner-algorithm-5.1.3-jhyde.jar
maven-resources-production java.lang.NegativeArraySizeException java.lang.NegativeArraySizeException 问题解决
maven-project-info-reports-plugin-2.1.jar
2) A directory called "apache-maven-3.x.y" will be created. 3) Add the bin directory to your PATH, eg: Unix-based operating systems (Linux, Solaris and Mac OS X) export PATH=/usr/local/apache-...
解决tomcat8-maven-plugin-3.0-r1655215.jar阿里云同有的问题。放到路径org\apache\tomcat\maven\tomcat8-maven-plugin\3.0-r1655215\就可以了
2. **添加Maven到PATH**: 将Apache Maven-3.8.1的`bin`目录路径添加到系统环境变量`PATH`中,这样命令行可以识别`mvn`命令。 3. **配置settings.xml**: Maven的配置文件`settings.xml`通常位于`用户主目录\.m2\`下...
`maven-compiler-plugin-3.8.0-source-release` 是 Maven 生态系统中不可或缺的一部分,它提供了可靠的源代码编译功能,使得开发者能够专注于编写代码,而无需关心构建过程的细节。通过理解 Maven 插件的工作原理和...
Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project
1. "apache-maven-3.5.4-bin.zip":这个文件包含了Maven 3.5.4的二进制发行版,用户解压后可以直接在操作系统上运行,进行Java项目的构建。 2. "apache-maven-3.5.4-src.zip":这个文件包含了Maven 3.5.4的源代码,...
maven-jomc-plugin-1.2.5-project.jar
maven-plugin-tools-java-2.4.1.jar
每个阶段都可以通过特定的插件来执行,例如,`maven-compiler-plugin`用于编译源代码,`maven-surefire-plugin`负责运行单元测试。Maven通过使用Project Object Model (POM)文件来描述项目信息,包括依赖、构建配置...
总结起来,"apache-maven-3.5.4-bin"压缩包包含的是一个完整的Maven 3.5.4发行版,它提供了一整套工具和框架,帮助Java开发者实现项目构建、依赖管理和版本控制。通过理解和掌握Maven,开发者可以提高工作效率,降低...
maven-scm-provider-svnjava-2.0.5.jar
maven-scm-provider-svnjava-2.0.3.jar
maven-java-formatter-plugin-0.4.jar
maven-project-info-reports-plugin-2.2.jar