1.使用Maven打出root.war以外的命名的war
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>${maven-war-plugin.version}</version> <configuration> <warName>pcc-service</warName> <webResources> <resource> <directory>src/main/webapp/WEB-INF</directory> <filtering>true</filtering> <targetPath>WEB-INF</targetPath> </resource> </webResources> </configuration> </plugin>
2.
如果父pom中使用的是<dependencies>....</dependencies>方式,则子pom会自动使用pom中的jar包;
如果父pom使用<dependencyManagement><dependencies>....</dependencies></dependencyManagement>
方式,则子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
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.3.RELEASE</version> <scope>runtime</scope> </dependency>
方法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
<parent> <groupId>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1</version> <relativePath>../parent/pom.xml</relativePath> </parent>