天天看点

maven in action(九) myeclipse maven项目svn管理

项目搭建完毕后,还有一个关键是怎样提交maven代码到svn,团队中的其他人怎样根据svn地址下载maven源码,并生成maven项目?

maven提交到svn

提交svn,主要是提交源代码,提交src/main/java 文件夹下的源代码,提交资源文件src/main/resources,提交pom.xml文件; 如有需要把测试代码一起提交,其他的就不需要提交。

从myeclipse导入svn 

用myeclipse导入 --选择从svn导入--选择svn地址后,检出为--作为工作空间中的项目检出--修改项目名称,之后下载下来的是源代码和文件。找到项目的位置,修改project 文件中maven项目的相关属性 , 然后再F5刷新我们的项目, 这样就可以运行啦。修改的.project 文件代码如下 :

<buildSpec>
		<buildCommand>
			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
			<triggers>full,incremental,</triggers>
			<arguments>
				<dictionary>
					<key>LaunchConfigHandle</key>
					<value><project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator (2).launch</value>
				</dictionary>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.common.project.facet.core.builder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.validation.validationbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
	</natures>
           

这样就可以提交svn和下载svn代码,并在本地上运行和测试maven项目了。