You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2018/09/01 11:25:00 UTC
[jira] [Commented] (MCOMPILER-357) Compiler ignores
generated-sources not used in regular sources
[ https://issues.apache.org/jira/browse/MCOMPILER-357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16599614#comment-16599614 ]
Karl Heinz Marbaise commented on MCOMPILER-357:
-----------------------------------------------
There are several issues with your setup:
I would suggest to get it like this:
{code:xml}
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>AvroGeneration</groupId>
<artifactId>GenerateAndCompile</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.8.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<fieldVisibility>PRIVATE</fieldVisibility>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
{code}
Keep your avro files in the location you have...
Furthermore If you use the above configuration everything will be generated correctly and the classes will be compiled correctly:
{code}
~/ws-git-maven-bugs/MCOMPILER-357$ tree target/
target/
├── GenerateAndCompile-1.0-SNAPSHOT.jar
├── classes
│ ├── avro
│ │ ├── Notification$1.class
│ │ ├── Notification$Builder.class
│ │ ├── Notification.class
│ │ ├── NotificationRequest$1.class
│ │ ├── NotificationRequest$Builder.class
│ │ └── NotificationRequest.class
│ └── java
│ └── UseSomething.class
├── generated-sources
│ ├── annotations
│ └── avro
│ └── avro
│ ├── Notification.java
│ └── NotificationRequest.java
├── maven-archiver
│ └── pom.properties
└── maven-status
└── maven-compiler-plugin
├── compile
│ └── default-compile
│ ├── createdFiles.lst
│ └── inputFiles.lst
└── testCompile
└── default-testCompile
└── inputFiles.lst
14 directories, 14 files
{code}
I can import this project without any errors into Eclipse If I add the {{target/generated-sources/avro}} to the build path which is a lack of support of the avro-maven-plugin which should handle this correctly or more accurate using a m2e connector in Eclipse...
> Compiler ignores generated-sources not used in regular sources
> --------------------------------------------------------------
>
> Key: MCOMPILER-357
> URL: https://issues.apache.org/jira/browse/MCOMPILER-357
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.8.0
> Reporter: Leonardo Contreras
> Priority: Major
> Labels: build, maven
> Attachments: GenerateAndCompile.zip
>
>
> When using the a generated-sources directory, if no classes use the ones defined in the generated sources it works ok, but if one of the non-generated classes uses a generated-sources class, the ones not used are ignored.
> I worked around with an unused import.
> Attached is a project that shows the issue.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)