Maven 常用操作和常见问题


常见操作

上传到maven资源库

mvn deploy:deploy-file -DgroupId=com.chinapay -DartifactId=netpayclient -Dversion=1.0 -Dpackaging=jar -Dfile=D:\netpayclient-1.0.jar -Durl=http://192.16.220.232:8082/content/repositories/thirdparty/ -DrepositoryId=releases 

常见问题

pom.xml问题修复: Plugin execution not covered by lifecycle

Problems and how to fix

If you are using Eclipse together with m2eclipse on Windows, you may see errors on the pom.xml's of your created project that say: Description Resource Path Location Type

Plugin execution not covered by lifecycle configuration: com.googlecode.mavenfilesync:maven-filesync-plugin:1.0.0:generate (execution: default, phase: initialize) pom.xml /myhippoproject-cms line 5 Maven Project Build Lifecycle Mapping Problem

You can fix this as follows:

1.open the 'Problems' view: 'Window' -> 'Show View' -> 'Problems'
2.right-click on one of the red errors that say 'Plugin execution not covered by lifecycle configuration: com.googlecode.mavenfilesync:maven-filesync-plugin:1.0.0:generate (execution: default, phase: initialize)'
3.from the menu, choose 'Quick Fix'
4.in the Quick Fix dialog, select the fix 'Permanently mark goal generate in pom.xml as ignored in Eclipse build' and click 'Finish'. Select 'OK' in the next dialog to apply the fix to the 'cms' or 'site' pom. Do not use the root pom here.
5.Repeat steps 2-4 for the other, identical error
6.Eclipse will now show two new red errors: 'Projct configuration is not up-to-date with pom.xml. Run project configuration update'. Right-click on one of these errors and choose 'Quick Fix' again.
7.The only suggested quick fix is 'Update project configuration'. Select all resources and click 'Finish'.

The above steps actually add the following to the section of the files 'site/pom.xml' and 'cms/pom.xml':

<</code>pluginManagement>
  <</code>plugins>
    <</code>plugin>
      <</code>groupId>org.eclipse.m2e</</code>groupId>
      <</code>artifactId>lifecycle-mapping</</code>artifactId>
      <</code>version>1.0.0</</code>version>
      <</code>configuration>
        <</code>lifecycleMappingMetadata>
          <</code>pluginExecutions>
            <</code>pluginExecution>
              <</code>pluginExecutionFilter>
                <</code>groupId>com.googlecode.mavenfilesync</</code>groupId>
                <</code>artifactId>maven-filesync-plugin</</code>artifactId>
                <</code>versionRange>[1.0.0,)</</code>versionRange>
                <</code>goals>
                  <</code>goal>generate</</code>goal>
                </</code>goals>
              </</code>pluginExecutionFilter>
              <</code>action>
                <</code>ignore></</code>ignore>
              </</code>action>
            </</code>pluginExecution>
          </</code>pluginExecutions>
        </</code>lifecycleMappingMetadata>
      </</code>configuration>
    </</code>plugin>
  </</code>plugins>
</</code>pluginManagement> 
Joyce /
Published under (CC) BY-NC-SA in categories maven  tagged with maven