[ 
https://jira.codehaus.org/browse/MCOMPILER-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=356369#comment-356369
 ] 

Vincent Massol edited comment on MCOMPILER-122 at 11/19/14 12:25 AM:
---------------------------------------------------------------------

I've hit this problem too.

I've had to do the following 
(https://github.com/xwiki/xwiki-commons/blob/master/pom.xml#L762):

{noformat}
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.2</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
          <executions>
            <!-- We need custom sourcepaths for our Component Annotation 
Process work
                (See ComponentCheckerAnnotationProcessor.java). This is 
required because of
                http://jira.codehaus.org/browse/MCOMPILER-122.
                However note that IntelliJ IDEA doesn't honor custom 
sourcepaths, see
                https://youtrack.jetbrains.com/issue/IDEA-133120, which means 
that you need to turn off
                Annotation Processing in IDEA or IDEA will generate errors 
while building modules -->
            <execution>
              <id>default-compile</id>
              <configuration>
                <compilerArguments>
                  
<sourcepath>${project.basedir}/src/main/java:${project.basedir}/src/main/resources</sourcepath>
                </compilerArguments>
              </configuration>
            </execution>
            <execution>
              <id>default-testCompile</id>
              <configuration>
                <compilerArguments>
                  
<sourcepath>${project.basedir}/src/test/java:${project.basedir}/src/test/resources</sourcepath>
                </compilerArguments>
              </configuration>
            </execution>
          </executions>
        </plugin>
{noformat}

However this isn't perfect. It works in Maven but fails in IDEA (see 
https://youtrack.jetbrains.com/issue/IDEA-133120). I'm also not sure it works 
on Windows machines (but that could be fixed with profiles).

In addition I've noticed that it runs javac with 2 -sourcepath parameters! For 
example:

{noformat}
[DEBUG] -d 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/classes
 -classpath 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/classes:/Users/vmassol/.m2/repository/org/xwiki/commons/xwiki-commons-tool-component-generation/6.4-SNAPSHOT/xwiki-commons-tool-component-generation-6.4-SNAPSHOT.jar:
 
-sourcepath 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/src/main/java:/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/generated-sources/annotations:
 
-s 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/generated-sources/annotations
 
-g -deprecation -target 1.7 -source 1.7 -encoding UTF-8 
-sourcepath 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/src/main/java:/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/src/main/resources
 -Xlint:all
{noformat}

And luckily it seems javac will take the last one...

In any case it would be great to fix it :)

Thanks




was (Author: vmassol):
I've hit this problem too.

I've had to do the following 
(https://github.com/xwiki/xwiki-commons/blob/master/pom.xml#L762):

{noformat}
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.2</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
          <executions>
            <!-- We need custom sourcepaths for our Component Annotation 
Process work
                (See ComponentCheckerAnnotationProcessor.java). This is 
required because of
                http://jira.codehaus.org/browse/MCOMPILER-122.
                However note that IntelliJ IDEA doesn't honor custom 
sourcepaths, see
                https://youtrack.jetbrains.com/issue/IDEA-133120, which means 
that you need to turn off
                Annotation Processing in IDEA or IDEA will generate errors 
while building modules -->
            <execution>
              <id>default-compile</id>
              <configuration>
                <compilerArguments>
                  
<sourcepath>${project.basedir}/src/main/java:${project.basedir}/src/main/resources</sourcepath>
                </compilerArguments>
              </configuration>
            </execution>
            <execution>
              <id>default-testCompile</id>
              <configuration>
                <compilerArguments>
                  
<sourcepath>${project.basedir}/src/test/java:${project.basedir}/src/test/resources</sourcepath>
                </compilerArguments>
              </configuration>
            </execution>
          </executions>
        </plugin>
{noformat}

However this isn't perfect. It works in Maven but fails in IDEA (see 
https://youtrack.jetbrains.com/issue/IDEA-133120). I'm also not sure it works 
on Windows machines (but that could be fixed with profiles).

In addition I've noticed that it runs javac with 2 -sourcepath parameters! For 
example:

{noformat}
[DEBUG] -d 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/classes
 -classpath 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/classes:/Users/vmassol/.m2/repository/org/xwiki/commons/xwiki-commons-tool-component-generation/6.4-SNAPSHOT/xwiki-commons-tool-component-generation-6.4-SNAPSHOT.jar:
 -sourcepath 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/src/main/java:/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/generated-sources/annotations:
 -s 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/target/generated-sources/annotations
 -g -deprecation -target 1.7 -source 1.7 -encoding UTF-8 -sourcepath 
/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/src/main/java:/Users/vmassol/dev/xwiki/git/xwiki-commons/xwiki-commons-core/xwiki-commons-stability/src/main/resources
 -Xlint:all
{noformat}

And luckily it seems javac will take the last one...

In any case it would be great to fix it :)

Thanks



> -sourcepath shall include resources
> -----------------------------------
>
>                 Key: MCOMPILER-122
>                 URL: https://jira.codehaus.org/browse/MCOMPILER-122
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Milos Kleint
>
> annotation processors which load non-Java resources from the sourcepath, will 
> currently get only the src/main/java folder.
> Unfortunately just adding src/main/resources to -sourcepath does not suffice, 
> due to a bug in javac:
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6929404
> see MCOMPILER-98 for more



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to