Maven使用tips(1)

阅读更多

1.使用Maven打出root.war以外的命名的war

			
				org.apache.maven.plugins
				maven-war-plugin
				${maven-war-plugin.version}
				 
     				pcc-service 
     				 
      					 
       						src/main/webapp/WEB-INF 
       						true 
       						WEB-INF 
      					      					
     				 
    			 
			

 

2.

如果父pom中使用的是....方式,则子pom会自动使用pom中的jar包;
如果父pom使用....

方式,则子pom不会自动使用父pom中的jar包,

这时如果子pom想使用的话,就要给出groupId和artifactId,无需给出version

 

3.当引用父pom.xml的依赖Jar时,没有加version时,报"dependencies.dependency.version is missing"的错

 

解决方法如下:

法一:Put the literal value of the version in the child pom

    
      org.springframework
      spring-core
      3.2.3.RELEASE
      runtime
    

 

方法2:Clear your .m2 cache normally located C:\Users\user.m2\repository.

              I would say I do this pretty frequently
              when I'm working in maven. Especially before committing so that

              I can be more confident CI will run.
              You don't have to nuke the folder every time, sometimes just your project packages

               and the .cache folder are enough.

方法3:Add a relativePath tag to your parent pom declaration

   
      com.mycompany.app
      my-app
      1
     ../parent/pom.xml
    

 
 

你可能感兴趣的:(maven)