Java classes get compiled via external maven inside eclipse but not (with same maven) from command line

Bamboomy :

Ok, I've worked with maven ever since I started working (about 10 years ago) but this one really puzzles me...

This is my pom:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>company.project</groupId>
    <artifactId>Artifact</artifactId>
    <packaging>war</packaging>
    <version>1.0.3-SNAPSHOT</version>
    <name>Name</name>

    <properties>
        <project.build.sourceEncoding>iso-8859-1</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.birt.runtime</groupId>
            <artifactId>org.eclipse.birt.runtime</artifactId>
            <version>4.6.0-20160607</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>1.6</version>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>2.0.2</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
    </dependencies>

    <build>

        <finalName>${project.name}</finalName>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

So far nothing special (I suppose); the behavior is quite different nevertheless...

When I run this via eclipse with M2E:

  • inside the target folder the class files appear (under target\classes)
  • they are also inside the generated war

When I run this via the command line:

  • none of the two stated above...

This quite puzzles me because usually this is the other way around and there is not much exotic in the pom that gives me any reasons to worry,

Not much people seem to have this issue apparently...

Can anyone give me a pointer to where to start looking for this to work?

This is what maven from command line claims:

[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ Reporting2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 37 source files to C:\Project\wss\maven\Sysper2\Reporting_maven\target\classes

But not one file is to be found in that directory...

Any help appreciated :)

versions:

  • eclipse neon 3
  • maven 3.3.9 (both externally used inside eclipse as independently)
  • jdk 1.7

a (puzzled) S.

ps: also

mvn -X clean install

Doesn't give any apparent errors/warnings...

edit: some additional info:

  • On my computer it does compile if I use jdk8
  • On my colleague's computer it doesn't work at all (maven 3.3.3; jdk7 and/or 8)
Bamboomy :
<dependency>
     <groupId>org.eclipse.birt.runtime</groupId>
     <artifactId>org.eclipse.birt.runtime</artifactId>
     <version>4.6.0-20160607</version>
</dependency>

seemed to be 'causing' the issue...

downgrading to 4.4.2 made the issue vanish like snow in the Sun...

apparently it somehow let's maven generate two command line options:

[DEBUG] -d /Users/kama/ws-git-maven-bugs/failingCompile/target/classes -classpath .....
[DEBUG] -d /Users/kama/ws-git-maven-bugs/failingCompile/target/classes -classpath .....

which in the end causes an error of javac on command line:

javac: no source files
Usage: javac <options> <source files>
use -help for a list of possible options

this is a link to the issue in the maven compiler plug-in jira

Credits to Robert Scholte for pinpointing the black sheep...

Credits to Karl Heinz Marbaise for finding out what exactly went wrong...

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=469654&siteId=1