I would add :

1) maven-eclipse-plugin is not to be used anymore. If you need it in
eclipse don't use any maven plugin but only http://eclipse.org/m2e/

2) exec-maven-plugin is not for compilation, it's for execution inside a
maven build (comment says otherwise). You seem to have mixing it with
maven-assembly-plugin (configuration is clearly wrong)

3) If you need to run it, I would rather use
http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/
and remove the 3 last plugins.



On Mon, Feb 2, 2015 at 3:40 PM, Karl Heinz Marbaise <khmarba...@gmx.de>
wrote:

> Hi,
>
> first rule in Maven keep the conventions[1]...meaning convention over
> configuration:
>
> source code:
>
> src/main/java
>
> resources for production code:
>
> src/main/resources
>
> Tests:
>
> src/test/java
>
> resources for tests:
>
> src/test/resources
>
> move your files to the correct location
> etc.
>
>
> Remove the following lines:
>
> <sourceDirectory>${basedir}/src/org/apache/hadoop/mapred/examples</sourceDirectory>
>
>
> maven-compiler-plugin:
> >      <includes>
> >        <include>src/**/*.java</include>
> >      </includes>
>
>
> does not make sense at all:
>
> >    <resources>
> >        <resource>
> >            <directory>target</directory>
> >            <includes><include>**/*.class</include></includes>
> >        </resource>
> >        <resource>
> >            <directory>src/main/resources/META-INF</directory>
> >            <targetPath>${basedir}/target</targetPath>
> >            <includes> <include>log4j.properties</include>
> >            <include>servers.json</include> </includes>
> >        </resource>
> >    </resources>
>
>
>
> Kind regards
> Karl Heinz Marbaise
>
> [1] http://maven.apache.org/guides/introduction/
> introduction-to-the-standard-directory-layout.html
>
>
> On 2/2/15 3:27 PM, xeonmailinglist wrote:
>
>> Hi,
>>
>> I can’t compile my java class using my |pom.xml|, and I can’t find the
>> problem. Can anyone help me to point what it is wrong?
>>
>> Directory structure
>>
>> |hadoop-wordcount-coc$ tree
>> .
>> ├── output.txt
>> ├── pom.xml
>> └── src
>>      └── org
>>          └── apache
>>              └── hadoop
>>                  └── mapred
>>                      └── examples
>>                          ├── WordCount.java
>>                          └── workbench.xmi
>> |
>>
>> output of the jar created with with |pom.xml|
>>
>> |hadoop-wordcount-coc$ jar tf target/wordcount.jar
>> META-INF/
>> META-INF/MANIFEST.MF
>> META-INF/maven/
>> META-INF/maven/org.apache.hadoop.mapred.example/
>> META-INF/maven/org.apache.hadoop.mapred.example/WordCount/
>> META-INF/maven/org.apache.hadoop.mapred.example/WordCount/pom.xml
>> META-INF/maven/org.apache.hadoop.mapred.example/WordCount/pom.properties
>> |
>>
>> |pom.xml|
>>
>> |hadoop-wordcount-coc$ cat pom.xml
>> <project xmlns="http://maven.apache.org/POM/4.0.0";
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>>    <modelVersion>4.0.0</modelVersion>
>>
>>    <groupId>org.apache.hadoop.mapred.example</groupId>
>>    <artifactId>WordCount</artifactId>
>>    <version>1.0-SNAPSHOT</version>
>>    <packaging>jar</packaging>
>>
>>    <name>WordCount CoC</name>
>>    <url>http://maven.apache.org</url>
>>
>>    <properties>
>>      <jdk.version>1.7</jdk.version>
>>      <junit.version>4.11</junit.version>
>>      <log4j.version>1.2.17</log4j.version>
>>    </properties>
>>
>>
>>    <dependencies>
>>      <dependency>
>>        <groupId>junit</groupId>
>>        <artifactId>junit</artifactId>
>>        <version>4.8.2</version>
>>        <scope>test</scope>
>>      </dependency>
>>    <dependency>
>>      <groupId>org.apache.hadoop</groupId>
>>      <artifactId>hadoop-yarn-api</artifactId>
>>      <version>2.6.0</version>
>>    </dependency>
>>    </dependencies>
>>
>> <build>
>>    <finalName>wordcount</finalName>
>>
>> <sourceDirectory>${basedir}/src/org/apache/hadoop/mapred/
>> examples</sourceDirectory>
>>
>>    <plugins>
>>
>>      <!-- download source code in Eclipse, best practice -->
>>      <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-eclipse-plugin</artifactId>
>>        <version>2.9</version>
>>        <configuration>
>>      <downloadSources>true</downloadSources>
>>      <downloadJavadocs>false</downloadJavadocs>
>>        </configuration>
>>      </plugin>
>>
>>      <!-- Set a compiler level -->
>>      <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-compiler-plugin</artifactId>
>>        <version>2.3.2</version>
>>        <configuration>
>>      <source>${jdk.version}</source>
>>      <target>${jdk.version}</target>
>>      <includes>
>>        <include>src/**/*.java</include>
>>      </includes>
>>        </configuration>
>>      </plugin>
>>
>>      <!-- Compile the code -->
>>       <!-- plugin>
>>              <artifactId>exec-maven-plugin</artifactId>
>>              <configuration>
>>
>> <mainClass>org.apache.hadoop.mapred.examples.WordCount</mainClass>
>>                <archive>
>>                  <manifest>
>>                    <mainClass>fully.qualified.MainClass</mainClass>
>>                  </manifest>
>>                  <manifestEntries>
>>                      <Class-Path>.</Class-Path>
>>                  </manifestEntries>
>>                </archive>
>>                <descriptorRefs>
>>                  <descriptorRef>jar-with-dependencies</descriptorRef>
>>                </descriptorRefs>
>>              </configuration>
>>              <groupId>org.codehaus.mojo</groupId>
>>              <version>1.2.1</version>
>>          </plugin -->
>>
>>
>>      <!-- Make this jar executable -->
>>      <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-jar-plugin</artifactId>
>>        <configuration>
>>        <mainClass>org.apache.hadoop.mapred.examples.WordCount</mainClass>
>>        <excludes>
>>          <exclude>**/log4j.properties</exclude>
>>        </excludes>
>>          <archive>
>>                <manifest>
>>              <addClasspath>true</addClasspath>
>>
>> <mainClass>org.apache.hadoop.mapred.examples.WordCount</mainClass>
>>              <classpathPrefix>dependency-jars/</classpathPrefix>
>>            </manifest>
>>          </archive>
>>        </configuration>
>>      </plugin>
>>
>>      <!-- Copy project dependency -->
>>      <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-dependency-plugin</artifactId>
>>        <version>2.5.1</version>
>>        <executions>
>>        <execution>
>>          <id>copy-dependencies</id>
>>          <phase>package</phase>
>>          <goals>
>>            <goal>copy-dependencies</goal>
>>          </goals>
>>          <configuration>
>>          <!-- exclude junit, we need runtime dependency only -->
>>          <includeScope>runtime</includeScope>
>>
>> <outputDirectory>${project.build.directory}/dependency-
>> jars/</outputDirectory>
>>
>>          </configuration>
>>        </execution>
>>        </executions>
>>      </plugin>
>>    </plugins>
>>    <resources>
>>        <resource>
>>            <directory>target</directory>
>>            <includes><include>**/*.class</include></includes>
>>        </resource>
>>        <resource>
>>            <directory>src/main/resources/META-INF</directory>
>>            <targetPath>${basedir}/target</targetPath>
>>            <includes> <include>log4j.properties</include>
>>            <include>servers.json</include> </includes>
>>        </resource>
>>    </resources>
>> </build>
>> </project>
>> |
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


-- 
Adrien Rivard

Reply via email to