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

Ok, I’ve been working with maven since I started working (about 10 years ago), but it 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> 

Nothing special so far (I suppose); the behavior is still quite different ...

When I run this through eclipse using M2E:

  • class files are displayed inside the target folder (in the target \ classes section)
  • they are also inside the generated war.

When I run this through the command line:

  • none of the two above ...

It puzzles me quite a bit, because, as a rule, it’s the other way around, and the pump doesn’t have much exotic, which gives me every reason to worry,

Not many people seem to have this problem, apparently ...

Can anyone give me a pointer on where to start working?

Here is what maven says from the command line:

 [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 in this directory ...

Any help is appreciated :)

version:

  • eclipse neon 3
  • maven 3.3.9 (both externally used internally by eclipse as independent)
  • jdk 1.7

a (puzzled) S.

ps: also

 mvn -X clean install 

It does not give any obvious errors / warnings ...

edit : additional information:

  • It compiles on my computer if I use jdk8
  • It doesn’t work at all on my colleagues computer (maven 3.3.3; jdk7 and / or 8)
+5
source share
1 answer
 <dependency> <groupId>org.eclipse.birt.runtime</groupId> <artifactId>org.eclipse.birt.runtime</artifactId> <version>4.6.0-20160607</version> </dependency> 

seemed to “cause” the problem ...

dropping to 4.4.2 made the problem disappear like snow on the Sun ...

Apparently, it somehow allows maven to 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 at the end causes a javac error on the command line:

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

this is a reference to a problem in the maven jira compiler module

Robert Scholte loans for the definition of a black sheep ...

Karl Heinz Marbaise loans to find out what exactly went wrong ...

+1
source

Source: https://habr.com/ru/post/1270587/


All Articles