Check out the netty project from github, summary of problems encountered when compiling

Maven Learning Record 3 - Create, compile, package, run projects: http://blog.csdn.net/yaya1943/article/details/48464371
Use maven to compile Java projects: http://www.tuicool.com/articles/ YfIfIrq
netty github import Eclipse: http://www.th7.cn/Program/java/201502/389732.shtml
Netty source code compilation environment build: http://blog.csdn.net/wuyinxian/article/details/46382051
Plugin error : execution not covered by lifecycle configuration:
https://stackoverflow.com/questions/7391201/plugin-error-execution-not-covered-by-lifecycle-configuration
Execution Not Covered: http://www.eclipse.org/m2e /documentation/m2e-execution-not-covered.html
netty project github address: https://github.com/netty/netty.git
       Since the netty project is in github, there are no .project and .classpath files, so it cannot be directly converted into an eclipse project Maven project. It needs to be compiled manually. For details, please refer to the two articles on netty source code compilation environment construction and netty github import into Eclipse.
Let's summarize the main problems encountered when checking out the netty project from github and compiling the maven project:
1.Failure to transfer io.netty:netty-tcnative:jar:${tcnative.classifier}:2.0.3.Final
This problem is mainly is the tcnative jar in netty-parent:
<groupId>io.netty</groupId>
<artifactId>netty-parent</artifactId>
<packaging>pom</packaging>
<version>4.1.13.Final-SNAPSHOT</version>

The following fragment is defined in the POM:
<tcnative.artifactId>netty-tcnative</tcnative.artifactId>
<tcnative.version>2.0.3.Final</tcnative.version>
<tcnative.classifier>${os.detected.classifier}</tcnative.classifier>

According to the classifier that detects tcnative by the operating system, we only need to comment out the above sentence as follows:
<!-- <tcnative.classifier>${os.detected.classifier}</tcnative.classifier> -->

At the same time, in the corresponding submodule project, the tcnative package dependency will:
<dependency>
  <groupId>${project.groupId}</groupId>
  <artifactId>${tcnative.artifactId}</artifactId>
  <classifier>${tcnative.classifier}</classifier>
  <optional>true</optional>
</dependency>

Change it to:
<dependency>
  <groupId>${project.groupId}</groupId>
  <artifactId>${tcnative.artifactId}</artifactId>
  <!-- <classifier>${tcnative.classifier}</classifier> -->
  <version>${tcnative.version}</version>
  <optional>true</optional>
</dependency>

Here we take the netty-handler submodule as an example:
<parent>
  <groupId>io.netty</groupId>
  <artifactId>netty-parent</artifactId>
  <version>4.1.13.Final-SNAPSHOT</version>
</parent>
<artifactId>netty-handler</artifactId>
<packaging>jar</packaging>

2.Plugin execution not covered by lifecycle configuration:
org.codehaus.mojo:build-helper-maven-plugin:1.10:add-source
(execution: add-source, phase: generate-sources)

This problem is mainly that the execution cannot be declared Due to the cycle configuration coverage, let's take the netty-common submodule as an example:
<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.10</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${collection.src.dir}</source>
              </sources>
            </configuration>
          </execution>
 </plugin>

The add-source execution whose groupId is org.codehaus.mojo and artifactId is build-helper-maven-plugin cannot be overwritten by the life cycle. The solution is to add the fragment corresponding to pluginManagement under the build tag of the pom file:
<build>
  <pluginManagement>
	    <plugins>
	       <plugin>
		     <groupId>org.eclipse.m2e</groupId>
		     <artifactId>lifecycle-mapping</artifactId>
		     <version>1.0.0</version>
		     <configuration>
		       <lifecycleMappingMetadata>
		         <pluginExecutions>
		          <!-- plugin executor filter -->
		           <pluginExecution>
		             <!-- plugin executor filter -->
		             <pluginExecutionFilter>
			       <!-- The groupId and artifactId here correspond to the ones above -->
		               <groupId>org.codehaus.mojo</groupId>
		               <artifactId>build-helper-maven-plugin</artifactId>
			       <!-- Version greater than or equal to 1.0.0 -->
		               <versionRange>[1.0.0,)</versionRange>
		               <goals>
			          <!-- The goal is the same as the goal in the execution goals of the above counterpart -->
		                  <goal>add-source</goal>
		                  <goal>add-test-source</goal>
		               </goals>
		             </pluginExecutionFilter>
		               <!-- plugin executor ignores groupId, goal in goals corresponding to artifactId -->
		             <action>
			        <!--Ignore execution-->
		               <ignore/>
		             </action>
		           </pluginExecution>
		          <!-- plugin executor filter -->
		           <pluginExecution>
		             <!-- plugin executor filter -->
		             <pluginExecutionFilter>
		               <groupId>org.codehaus.mojo</groupId>
		               <artifactId>xml-maven-plugin</artifactId>
		               <versionRange>[1.0.0,)</versionRange>
		               <goals>
		                  <goal>parse-version</goal>
		                  <goal>check-style</goal>
		               </goals>
		             </pluginExecutionFilter>
		               <!-- plugin executor ignores groupId, goal in goals corresponding to artifactId -->
		             <action>
		               <ignore/>
		             </action>
		           </pluginExecution>
		           <!-- plugin executor filter -->
		           <pluginExecution>
		             <!-- plugin executor filter -->
		             <pluginExecutionFilter>
		               <groupId>org.codehaus.gmaven</groupId>
		               <artifactId>groovy-maven-plugin</artifactId>
		               <versionRange>[1.0.0,)</versionRange>
		               <goals>
		                  <goal>execute</goal>
		               </goals>
		             </pluginExecutionFilter>
		               <!-- plugin executor ignores groupId, goal in goals corresponding to artifactId -->
		             <action>
		               <ignore/>
		             </action>
		           </pluginExecution>
		         </pluginExecutions>
		       </lifecycleMappingMetadata>
		     </configuration>
		    </plugin>
		   </plugins>
	   </pluginManagement>
</build>

There is another way to configure Maven -> Lifecycle mapping->lifecycle-mapping-metadata.xml , the
official show that this method is for Eclipse 4.2, the specific configuration is in Windows -> Preferences -> Maven -> Lifecycle mapping , the file (eclipse/plugins /org.eclipse.m2e.lifecyclemapping.defaults_1.2.0.20120903-1050.jar/lifecycle-mapping-metadata.xml) content is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
  <pluginExecutions>
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <goals>
          <goal>create-timestamp</goal>
        </goals>
        <versionRange>[0.0,)</versionRange>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>

    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <goals>
          <goal>list</goal>
        </goals>
        <versionRange>[0.0,)</versionRange>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>

    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.zeroturnaround</groupId>
        <artifactId>jrebel-maven-plugin</artifactId>
        <goals>
          <goal>generate</goal>
        </goals>
        <versionRange>[0.0,)</versionRange>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>

    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <goals>
          <goal>compile</goal>
        </goals>
        <versionRange>[0.0,)</versionRange>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>

    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <goals>
          <goal>copy-dependencies</goal>
          <goal>unpack</goal>
        </goals>
        <versionRange>[0.0,)</versionRange>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>
  </pluginExecutions>
</lifecycleMappingMetadata>

Note: The correspondence between groupId, artifactId, and goal in pluginExecutionFilter.

    Remember to reload after configuration. If you have multiple Eclipse workspaces or for a team project, strongly establish the way to use the configuration POM file, the first way.

Then update the project module (maven->update check force online update).

If there is still a problem, check whether it is because of JRE (JRE6-8), usually JRE7.

If the project does not have maven dependencies (Maven Dependencies), check whether the .class
and .project files of the project. The
class file contains the following information:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_17">
	<attributes>
		<attribute name="maven.pomderived" value="true"/>
	</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
	<attributes>
		<attribute name="maven.pomderived" value="true"/>
	</attributes>
</classpathentry>

If it is not included, add it, if it is different, modify it.

Is the .project file as follows:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>netty_trunk</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription
>
If there is no item, add it, if it is different, modify it.

Finally, remember to refresh the workspace project.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326464883&siteId=291194637