-
Notifications
You must be signed in to change notification settings - Fork 39
outputDirectory gets cleared with eclipse maven update in 1.1.3 #31
Comments
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> |
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? |
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> |
order in project pom is:
|
anything new here? |
Not yet. It feels like invalid behaviour from Eclipse's side, but I haven't yet verified it. |
@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? |
@timowest the eclipse log (error log view and also and no, the generator does not call this. it does not even have a |
I have the same or a similar problem:
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.
|
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. |
Happens for me as well - none of the "remedies" discussed here helps - perhaps fixing the plugin should have somewhat higher precedence... |
@lgoldstein Any ideas on how then? |
You are right - I was frustrated and lashed out - I apologize... |
I have the same problem |
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 |
Hello thank you, I worked included the dependencies apart |
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.:
Note that this seems to happen even if the added class Again - this observation is not 100% verified, but it does seem to occur rather consistently. |
That's interesting, I was going to encode this in the unit tests, but I was wondering. |
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. |
Can you for science use the older plugin, to see if it happens then? |
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... |
I was having this problem (eclipse deleting the generated sources). I went back to version 1.1.2, and it works now. |
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?
The text was updated successfully, but these errors were encountered: