Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

outputDirectory gets cleared with eclipse maven update in 1.1.3 #31

Open
dodgex opened this issue Nov 27, 2014 · 23 comments
Open

outputDirectory gets cleared with eclipse maven update in 1.1.3 #31

dodgex opened this issue Nov 27, 2014 · 23 comments

Comments

@dodgex
Copy link

dodgex commented Nov 27, 2014

we just bumped our apt-maven-plugin version from 1.1.2 to 1.1.3 and have issues with "Update Maven Project" in eclipse. it generates files, and then the outputDirectory gets cleaned but one file remains.

due to our project setup, it seems that the plugin generates the files, cleans the outputDirectory and then generates one more file.

here some info about our project setup:
some models are in src/main/java/*. these get generated first. but we also have one generated(by a maven plugin) model in target/generated-sources/gwt/*. the Q class for the generated model is the one that survives the maven project update in eclispse.

did you add a outputDirectory clean before generating new code?

@Shredder121
Copy link
Member

@timowest I think the FileSync doesn't cope well with the plugin executing twice in different folders?

@dodgex could you post the plugin configuration for the two source structures?

@dodgex
Copy link
Author

dodgex commented Nov 27, 2014

we do not have a special configuration for the two source structures.

in our global parent pom

                <plugin>
                    <groupId>com.mysema.maven</groupId>
                    <artifactId>apt-maven-plugin</artifactId>
                    <version>1.1.2</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>process</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/generated-sources/annotations</outputDirectory>
                                <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                            </configuration>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.mysema.querydsl</groupId>
                            <artifactId>querydsl-apt</artifactId>
                            <version>3.3.4</version>
                        </dependency>
                    </dependencies>
                </plugin>

in the actual project pom

            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
            </plugin>

@timowest
Copy link
Member

It appears that there are two executions of the apt-maven-plugin. The first with src/main/java as the source folder and the second one with target/generated-sources/gwt as the source folder.

@dodgex Could you also provide the configuration for the gwt code generation?

@dodgex
Copy link
Author

dodgex commented Nov 28, 2014

parent-pom (gwt related)

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <version>2.7.0</version>
                    <executions>
                        <execution>
                            <id>gwt-compile</id>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <runTarget>index.jsp</runTarget>
                        <copyWebapp>true</copyWebapp>
                        <hostedWebapp>${webappDirectory}</hostedWebapp>
                        <webappDirectory>${webappDirectory}</webappDirectory>
                    </configuration>
                </plugin>

project pom (gwt related)

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>source-generation</id>
                        <goals>
                            <goal>i18n</goal>
                            <goal>css</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
                    <runTarget>index.html</runTarget>
                    <i18nConstantsBundles>
                        <i18nConstantsBundle>xxx.client.Version</i18nConstantsBundle>
                    </i18nConstantsBundles>
                    <enableClosureCompiler>true</enableClosureCompiler>
                    <cssFiles>
                        <cssFile>xxx/client/view/widgets/transferstatus/Style.css</cssFile>
                        <cssFile>xxx/client/view/widgets/progress/Style.css</cssFile>
                        <cssFile>xxx/client/resources/css/BaseCss.css</cssFile>
                    </cssFiles>
                    <extraJvmArgs><![CDATA[-Dspring.profiles.active=dev]]></extraJvmArgs>
                </configuration>
            </plugin>

and again project pom, but related to the one model that gets generated

            <plugin>
                <groupId>xxx</groupId>
                <artifactId>xxx-generator</artifactId>
                <version>0.4.17-SNAPSHOT</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-class</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <csvDefinition>${basedir}/src/main/resources/xxx.json</csvDefinition>
                    <outputDirectory>${project.build.directory}/generated-sources/gwt/</outputDirectory>
                </configuration>
            </plugin>

@dodgex
Copy link
Author

dodgex commented Nov 28, 2014

order in project pom is:

  • gwt related generation
  • custom generator
  • apt-maven-plugin

@dodgex
Copy link
Author

dodgex commented Dec 20, 2014

anything new here?

@timowest
Copy link
Member

Not yet. It feels like invalid behaviour from Eclipse's side, but I haven't yet verified it.

@timowest
Copy link
Member

@dodgex Have you verified from the Eclipse logs if there are multiple executions of the apt-maven-plugin?

Also does your custom generator call project.addCompileSourceRoot(...) with the added target folder?

@dodgex
Copy link
Author

dodgex commented Jan 19, 2015

@timowest the eclipse log (error log view and also workspace\.metadata\.log) ony show some findbugs warning about missing javax classes.

and no, the generator does not call this. it does not even have a project field/param at all. it generates its source into a directory that is already known to the project/build

@hfs
Copy link

hfs commented Jul 25, 2016

I have the same or a similar problem:

  • Disable Project › Build Automatically…
  • Run Maven goal 'generate-sources', which runs apt-maven-plugin
  • Refresh the project in Eclipse, the generated source files are present as expected
  • Project › Build Project
  • The folder with generated sources is cleared and the project fails to compile.

To get more log info, I edited …/eclipse-workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback*.xml and changed the root level to DEBUG. After an Eclipse restart log file 0.log contains infos about the Maven plugins executed during a build.

apt-maven-plugin is only executed once for regular sources and once for test sources.

There are other source generation build steps running as Ant scripts. Their source folders are added via build-helper-maven-plugin:add-source.

A downgrade to 1.1.2 fixed the problem for me.

2016-07-25 13:55:10,951 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilder - Building project mymodule
2016-07-25 13:55:10,955 [Worker-7] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\user\.m2\repository
2016-07-25 13:55:10,977 [Worker-7] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\user\.m2\repository
2016-07-25 13:55:10,977 [Worker-7] DEBUG o.e.m.c.internal.embedder.MavenImpl - Reading Maven project: C:\Project\mymodule\pom.xml
2016-07-25 13:55:11,022 [Worker-7] DEBUG o.e.a.i.i.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=0, DefaultDependencyCollector.transformTime=0}
2016-07-25 13:55:11,031 [Worker-7] DEBUG o.e.a.i.i.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=0, DefaultDependencyCollector.transformTime=0}
2016-07-25 13:55:11,596 [Worker-7] DEBUG o.e.a.i.i.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=133, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=78, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=132, DefaultDependencyCollector.collectTime=554, DefaultDependencyCollector.transformTime=2}
2016-07-25 13:55:11,734 [Worker-7] DEBUG o.e.m.c.internal.embedder.MavenImpl - Read Maven project: C:\Project\mymodule\pom.xml in 757 ms
2016-07-25 13:55:11,735 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Build participants for MavenProject: com.organization:mymodule:2.0-SNAPSHOT @ C:\Project\mymodule\pom.xml
2016-07-25 13:55:11,738 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-remote-resources-plugin:1.4:process (execution: default, phase: initialize)
2016-07-25 13:55:11,738 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2016-07-25 13:55:11,738 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-antrun-plugin:1.8:run (execution: generate-sources, phase: generate-sources)
2016-07-25 13:55:11,738 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2016-07-25 13:55:11,738 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source (execution: add-source, phase: generate-sources)
2016-07-25 13:55:11,738 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2016-07-25 13:55:11,739 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: com.mysema.maven:apt-maven-plugin:1.1.3:process (execution: annotations-generate-sources, phase: generate-sources)
2016-07-25 13:55:11,739 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2016-07-25 13:55:11,739 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-resources-plugin:2.6:resources (execution: default-resources, phase: process-resources)
2016-07-25 13:55:11,739 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (execution: default-compile, phase: compile)
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-antrun-plugin:1.8:run (execution: generate-test-sources, phase: generate-test-sources)
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.codehaus.mojo:build-helper-maven-plugin:1.7:add-test-source (execution: add-test-sources, phase: generate-test-sources)
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: com.mysema.maven:apt-maven-plugin:1.1.3:test-process (execution: annotations-generate-test-sources, phase: generate-test-sources)
2016-07-25 13:55:11,740 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2016-07-25 13:55:11,752 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-resources-plugin:2.6:testResources (execution: default-testResources, phase: process-test-resources)
2016-07-25 13:55:11,752 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2016-07-25 13:55:11,752 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile (execution: default-testCompile, phase: test-compile)
2016-07-25 13:55:11,753 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (execution: default-test, phase: test)
2016-07-25 13:55:11,753 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-jar-plugin:2.6:jar (execution: default-jar, phase: package)
2016-07-25 13:55:11,753 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2016-07-25 13:55:11,753 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator : id=org.sonatype.m2e.mavenarchiver.jararchiverconfigurator class=org.sonatype.m2e.mavenarchiver.internal.JarArchiverConfigurator
2016-07-25 13:55:11,753 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Build participant: org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1
2016-07-25 13:55:11,766 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-jar-plugin:2.6:test-jar (execution: default, phase: package)
2016-07-25 13:55:11,766 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-source-plugin:3.0.0:jar-no-fork (execution: attach-sources, phase: package)
2016-07-25 13:55:11,766 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2016-07-25 13:55:11,766 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-source-plugin:3.0.0:test-jar-no-fork (execution: attach-sources, phase: package)
2016-07-25 13:55:11,766 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2016-07-25 13:55:11,766 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.codehaus.mojo:findbugs-maven-plugin:3.0.1:check (execution: default, phase: pre-integration-test)
2016-07-25 13:55:11,767 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-checkstyle-plugin:2.11:check (execution: default, phase: pre-integration-test)
2016-07-25 13:55:11,767 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-pmd-plugin:3.6:check (execution: default, phase: pre-integration-test)
2016-07-25 13:55:11,773 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-pmd-plugin:3.6:cpd-check (execution: default, phase: pre-integration-test)
2016-07-25 13:55:11,773 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-install-plugin:2.3.1:install (execution: default-install, phase: install)
2016-07-25 13:55:11,773 [Worker-7] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy (execution: default-deploy, phase: deploy)
2016-07-25 13:55:11,774 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source (execution: add-source, phase: generate-sources)
2016-07-25 13:55:11,780 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\config added.
2016-07-25 13:55:11,780 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\i18n added.
2016-07-25 13:55:11,780 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\corba added.
2016-07-25 13:55:11,781 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\jtb added.
2016-07-25 13:55:11,781 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\jjtree added.
2016-07-25 13:55:11,781 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\javacc added.
2016-07-25 13:55:11,781 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\apidocs added.
2016-07-25 13:55:11,781 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\help added.
2016-07-25 13:55:11,782 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Source directory: C:\Project\mymodule\target\generated-sources\apt added.
2016-07-25 13:55:11,782 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source (execution: add-source, phase: generate-sources) in 8 ms
2016-07-25 13:55:11,782 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution com.mysema.maven:apt-maven-plugin:1.1.3:process (execution: annotations-generate-sources, phase: generate-sources)
2016-07-25 13:55:11,791 [Worker-7] DEBUG o.e.a.i.i.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=133, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=78, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=132, DefaultDependencyCollector.collectTime=4, DefaultDependencyCollector.transformTime=3}
2016-07-25 13:55:11,945 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution com.mysema.maven:apt-maven-plugin:1.1.3:process (execution: annotations-generate-sources, phase: generate-sources) in 163 ms
2016-07-25 13:55:11,945 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.apache.maven.plugins:maven-resources-plugin:2.6:resources (execution: default-resources, phase: process-resources)
2016-07-25 13:55:11,964 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Using 'UTF-8' encoding to copy filtered resources.
2016-07-25 13:55:11,990 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Copying 114 resources
2016-07-25 13:55:12,009 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.apache.maven.plugins:maven-resources-plugin:2.6:resources (execution: default-resources, phase: process-resources) in 64 ms
2016-07-25 13:55:12,009 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.codehaus.mojo:build-helper-maven-plugin:1.7:add-test-source (execution: add-test-sources, phase: generate-test-sources)
2016-07-25 13:55:12,012 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Test Source directory: C:\Project\mymodule\target\generated-test-sources\config added.
2016-07-25 13:55:12,012 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Test Source directory: C:\Project\mymodule\target\generated-test-sources\i18n added.
2016-07-25 13:55:12,012 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Test Source directory: C:\Project\mymodule\target\generated-test-sources\corba added.
2016-07-25 13:55:12,013 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Test Source directory: C:\Project\mymodule\target\generated-test-sources\apt added.
2016-07-25 13:55:12,013 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.codehaus.mojo:build-helper-maven-plugin:1.7:add-test-source (execution: add-test-sources, phase: generate-test-sources) in 4 ms
2016-07-25 13:55:12,013 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution com.mysema.maven:apt-maven-plugin:1.1.3:test-process (execution: annotations-generate-test-sources, phase: generate-test-sources)
2016-07-25 13:55:12,036 [Worker-7] DEBUG o.e.a.i.i.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=133, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=78, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=6, ConflictResolver.conflictItemCount=132, DefaultDependencyCollector.collectTime=15, DefaultDependencyCollector.transformTime=6}
2016-07-25 13:55:12,183 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution com.mysema.maven:apt-maven-plugin:1.1.3:test-process (execution: annotations-generate-test-sources, phase: generate-test-sources) in 170 ms
2016-07-25 13:55:12,183 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.apache.maven.plugins:maven-resources-plugin:2.6:testResources (execution: default-testResources, phase: process-test-resources)
2016-07-25 13:55:12,188 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Using 'UTF-8' encoding to copy filtered resources.
2016-07-25 13:55:12,279 [Worker-7] INFO  o.e.m.c.i.embedder.EclipseLogger - Copying 563 resources
2016-07-25 13:55:12,328 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant for plugin execution org.apache.maven.plugins:maven-resources-plugin:2.6:testResources (execution: default-testResources, phase: process-test-resources) in 145 ms
2016-07-25 13:55:12,328 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Executing build participant org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1 for plugin execution org.apache.maven.plugins:maven-jar-plugin:2.6:jar (execution: default-jar, phase: package)
2016-07-25 13:55:12,332 [Worker-7] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\user\.m2\repository
2016-07-25 13:55:12,675 [Worker-7] DEBUG o.e.a.i.i.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=94, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=39, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1, ConflictResolver.conflictItemCount=86, DefaultDependencyCollector.collectTime=251, DefaultDependencyCollector.transformTime=1}
2016-07-25 13:55:13,081 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilderImpl - Finished executing build participant org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1 for plugin execution org.apache.maven.plugins:maven-jar-plugin:2.6:jar (execution: default-jar, phase: package) in 753 ms
2016-07-25 13:55:13,182 [Worker-7] DEBUG o.e.m.c.i.builder.MavenBuilder - Built project mymodule in 2230 ms

@abouhassan
Copy link

I have the same problem using plugins 1.1.3

I figure out that the problem occurs when i added manually the folder src/generated-sources/java by doing project -> right click -> properties in java build path tab.

Hence it is added twice -> manually and by the pom.xml file

the problem is solved when i delete the one manually added from eclipse java build path.

@lgoldstein
Copy link

Happens for me as well - none of the "remedies" discussed here helps - perhaps fixing the plugin should have somewhat higher precedence...

@Shredder121
Copy link
Member

@lgoldstein Any ideas on how then?
Thanks for the bump, but this doesn't help.
Findings, pitching ideas, anything but snarky comments helps.

@lgoldstein
Copy link

You are right - I was frustrated and lashed out - I apologize...

@joseasanchezzz91
Copy link

I have the same problem

@lgoldstein
Copy link

Here is one observation about it - this happens a lot since I moved the configuration that activates the plugin to the parent POM instead of the individual projects, and also since we upgraded to QueryDSL 4.x - e.g.:

    <!-- in parent POM -->
<pluginManagement>
    <plugins>

              <plugin>
                    <groupId>com.mysema.maven</groupId>
                    <artifactId>apt-maven-plugin</artifactId>
                    <version>1.1.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>process</goal>
                            </goals>
                            <phase>process-sources</phase>
                            <configuration>
                                <outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
                                <processors>
                                    <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                                </processors>
                                <options>
                                    <querydsl.entityAccessors>true</querydsl.entityAccessors>
                                </options>
                            </configuration>
                        </execution>
                    </executions>
                    <dependencies>
                            <!-- Make sure using OUR version of the dependencies -->
                        <dependency>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-apt</artifactId>
                            <version>${querydsl.version}</version>
                            <exclusions>
                                <exclusion> <!-- We provide our own -->
                                    <groupId>javax.transaction</groupId>
                                    <artifactId>jta</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>
                        <dependency>
                            <groupId>javax.transaction</groupId>
                            <artifactId>javax.transaction-api</artifactId>
                            <version>${jta.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-jpa</artifactId>
                            <classifier>apt</classifier>
                            <version>${querydsl.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-codegen</artifactId>
                            <version>${querydsl.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-core</artifactId>
                            <version>${querydsl.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.querydsl</groupId>
                            <artifactId>querydsl-sql</artifactId>
                            <version>${querydsl.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

    </pugins>
</pluginManagement>

and in the individual project(s):

<build>
    <plugins>

            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
            </plugin>

    </plugins>
</build>

I have heard (unconfirmed though) that there are some issues regarding m2e plugins and how they handle inherited configurations

@joseasanchezzz91
Copy link

Hello thank you, I worked included the dependencies apart

@lgoldstein
Copy link

lgoldstein commented Apr 25, 2018

Perhaps I can help narrow down the problem - it seems to me (not 100% sure) from my own experience that this issue is most likely to happen when one adds a new class to the module being built with this plugin. E.g.:

  • The module has classes A, B, C and has been built with the plugin

  • The developer adds via Eclipse class D and then selects Project -> Build Project from the Eclipse menu
    ==> result: the generated output sources disappear

  • A variation on this can also occur if the user refreshes the Eclipse project (via F5) and then builds it from within Eclipse via Project -> Build Project. E.g., when switching in GIT from one branch to another.

Note that this seems to happen even if the added class D is not a JPA one - i.e., contains no JPA annotations of any type.

Again - this observation is not 100% verified, but it does seem to occur rather consistently.

@Shredder121
Copy link
Member

That's interesting, I was going to encode this in the unit tests, but I was wondering.
Is it because of us or Eclipse?

@lgoldstein
Copy link

I admit I don't have enough know-how to tell which - I do know it did not happen with the older plugin version, but we also upgraded Eclipse version during that period so it is hard to tell which action caused it. My subjective (and admittedly not 100% foolproof) feeling is that it is more likely linked to the plugin rather than Eclipse - but I don't want to confuse you or set you astray with misinformation, so please treat this only as my not-validated opinion.

@Shredder121
Copy link
Member

Can you for science use the older plugin, to see if it happens then?
I won't make you use an older Eclipse version, but I need to find out where the handling goes wrong.

@lgoldstein
Copy link

It may take some time - I am going to be absent from the office for the next 2 weeks or so. In any case, I can only do it once (and will try to), but I doubt it will provide useful insight into the problem since it is intermittent - i.e., the fact that it might not happen 1,2,3 times with the older version does not necessarily indicate that the problem does not occur with it...

@ronaldtm
Copy link

I was having this problem (eclipse deleting the generated sources). I went back to version 1.1.2, and it works now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants