New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

querydsl "export" should avoid updating files if possible #26

Closed
cowwoc opened this Issue Oct 10, 2011 · 13 comments

Comments

Projects
None yet
2 participants
@cowwoc
Contributor

cowwoc commented Oct 10, 2011

I am using the "export" goal of querydsl-maven-plugin to generate query classes. Unfortunately, each time querydsl touches files, it causes Maven to rebuild a JAR file for the project. Then, anything that depends on that project ends up rebuilding as well.

querydsl should avoid updating query files if they have not been changed. Doing so, would substantially speed up my builds.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 11, 2011

Member

Are you talking about triggering querydsl:export from an IDE? I don't see how the current behaviour would cause problems when used from the command line.

Member

timowest commented Oct 11, 2011

Are you talking about triggering querydsl:export from an IDE? I don't see how the current behaviour would cause problems when used from the command line.

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Oct 12, 2011

Contributor

On 11/10/2011 6:04 AM, Timo Westkämper wrote:

Are you talking about triggering querydsl:export from an IDE? I don't see how the current behaviour would cause problems when used from the command line.

Hi Timo,

 I believe that Netbeans invokes Maven in the same way the 

command-line would. One of the projects being built invokes
querydsl:export (which updates files even if they haven't changed). The
problem is that once files are updated, maven-jar-plugin creates a new
JAR file. Once it creates a new JAR file, anything that depends on it
rebuilds as well, etc.

Gili

Contributor

cowwoc commented Oct 12, 2011

On 11/10/2011 6:04 AM, Timo Westkämper wrote:

Are you talking about triggering querydsl:export from an IDE? I don't see how the current behaviour would cause problems when used from the command line.

Hi Timo,

 I believe that Netbeans invokes Maven in the same way the 

command-line would. One of the projects being built invokes
querydsl:export (which updates files even if they haven't changed). The
problem is that once files are updated, maven-jar-plugin creates a new
JAR file. Once it creates a new JAR file, anything that depends on it
rebuilds as well, etc.

Gili

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 12, 2011

Member

Hi Gili.

Does NetBeans trigger mvn install or something else? packaging is quite at
the end of the default lifecycle.

It is difficult to determine when to overwrite and when not. How to track if
a schema has changed or not? Comparing file contents beforehand would be
IMHO too expensive.

Timo

On Wed, Oct 12, 2011 at 5:18 PM, cowwoc <
reply@reply.github.com>wrote:

On 11/10/2011 6:04 AM, Timo Westkmper wrote:

Are you talking about triggering querydsl:export from an IDE? I don't see
how the current behaviour would cause problems when used from the command
line.

Hi Timo,

I believe that Netbeans invokes Maven in the same way the

command-line would. One of the projects being built invokes
querydsl:export (which updates files even if they haven't changed). The
problem is that once files are updated, maven-jar-plugin creates a new
JAR file. Once it creates a new JAR file, anything that depends on it
rebuilds as well, etc.

Gili

Reply to this email directly or view it on GitHub:
#26 (comment)

Timo Westkmper timo.westkamper@mysema.com
Mysema Oy, Vilhonkatu 5 A, FIN-00100 Helsinki, Finland
+358 (0)40 591 2172
http://www.mysema.com

Member

timowest commented Oct 12, 2011

Hi Gili.

Does NetBeans trigger mvn install or something else? packaging is quite at
the end of the default lifecycle.

It is difficult to determine when to overwrite and when not. How to track if
a schema has changed or not? Comparing file contents beforehand would be
IMHO too expensive.

Timo

On Wed, Oct 12, 2011 at 5:18 PM, cowwoc <
reply@reply.github.com>wrote:

On 11/10/2011 6:04 AM, Timo Westkmper wrote:

Are you talking about triggering querydsl:export from an IDE? I don't see
how the current behaviour would cause problems when used from the command
line.

Hi Timo,

I believe that Netbeans invokes Maven in the same way the

command-line would. One of the projects being built invokes
querydsl:export (which updates files even if they haven't changed). The
problem is that once files are updated, maven-jar-plugin creates a new
JAR file. Once it creates a new JAR file, anything that depends on it
rebuilds as well, etc.

Gili

Reply to this email directly or view it on GitHub:
#26 (comment)

Timo Westkmper timo.westkamper@mysema.com
Mysema Oy, Vilhonkatu 5 A, FIN-00100 Helsinki, Finland
+358 (0)40 591 2172
http://www.mysema.com

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Oct 12, 2011

Contributor
 I'll check on mvn install later on. As for how to determine when to 

overwrite or not, the only approach I can think of is:

  1. Every time a file is generated, save a marker file somewhere
    (maven-dependency-plugin does this) containing a hash of the exported file.
  2. When export is run the next time, you generate the body normally but
    before writing to disk you compare with the hash found in the marker file.

Gili

On 12/10/2011 10:25 AM, Timo Westkämper wrote:

Hi Gili.

Does NetBeans trigger mvn install or something else? packaging is quite at
the end of the default lifecycle.

It is difficult to determine when to overwrite and when not. How to track if
a schema has changed or not? Comparing file contents beforehand would be
IMHO too expensive.

Timo

On Wed, Oct 12, 2011 at 5:18 PM, cowwoc<
reply@reply.github.com>wrote:

On 11/10/2011 6:04 AM, Timo Westkmper wrote:

Are you talking about triggering querydsl:export from an IDE? I don't see
how the current behaviour would cause problems when used from the command
line.
Hi Timo,

 I believe that Netbeans invokes Maven in the same way the

command-line would. One of the projects being built invokes
querydsl:export (which updates files even if they haven't changed). The
problem is that once files are updated, maven-jar-plugin creates a new
JAR file. Once it creates a new JAR file, anything that depends on it
rebuilds as well, etc.

Gili

Reply to this email directly or view it on GitHub:
#26 (comment)

Contributor

cowwoc commented Oct 12, 2011

 I'll check on mvn install later on. As for how to determine when to 

overwrite or not, the only approach I can think of is:

  1. Every time a file is generated, save a marker file somewhere
    (maven-dependency-plugin does this) containing a hash of the exported file.
  2. When export is run the next time, you generate the body normally but
    before writing to disk you compare with the hash found in the marker file.

Gili

On 12/10/2011 10:25 AM, Timo Westkämper wrote:

Hi Gili.

Does NetBeans trigger mvn install or something else? packaging is quite at
the end of the default lifecycle.

It is difficult to determine when to overwrite and when not. How to track if
a schema has changed or not? Comparing file contents beforehand would be
IMHO too expensive.

Timo

On Wed, Oct 12, 2011 at 5:18 PM, cowwoc<
reply@reply.github.com>wrote:

On 11/10/2011 6:04 AM, Timo Westkmper wrote:

Are you talking about triggering querydsl:export from an IDE? I don't see
how the current behaviour would cause problems when used from the command
line.
Hi Timo,

 I believe that Netbeans invokes Maven in the same way the

command-line would. One of the projects being built invokes
querydsl:export (which updates files even if they haven't changed). The
problem is that once files are updated, maven-jar-plugin creates a new
JAR file. Once it creates a new JAR file, anything that depends on it
rebuilds as well, etc.

Gili

Reply to this email directly or view it on GitHub:
#26 (comment)

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Oct 19, 2011

Contributor

To answer your question, yes: Netbeans triggers "mvn install".

The project in question does two things: it exports query classes (it's not clear what the default phase of "export" is but it occurs before the compilation step) and compiles classes that issue queries. In my case, neither the database nor the classes issuing queries have changed, but querydsl is updated the query classes anyway (causing the JAR file to get updated).

Contributor

cowwoc commented Oct 19, 2011

To answer your question, yes: Netbeans triggers "mvn install".

The project in question does two things: it exports query classes (it's not clear what the default phase of "export" is but it occurs before the compilation step) and compiles classes that issue queries. In my case, neither the database nor the classes issuing queries have changed, but querydsl is updated the query classes anyway (causing the JAR file to get updated).

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 19, 2011

Member

I added some conditional export. Could you make sure that the commited behaviour works for your Netbeans build?

Member

timowest commented Oct 19, 2011

I added some conditional export. Could you make sure that the commited behaviour works for your Netbeans build?

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Oct 19, 2011

Contributor

Hi Timo,

Can you put out a SNAPSHOT build for me to try? When I tried building the project here I got this compiler error:

querydsl-core\src\main\java\com\mysema\util\ResultSetAdapter.java:[20,7] error: ResultSetAdapter is not abstract and does not override abstract method getObject(String,Class) in ResultSet

I only have JDK 1.7 installed. I suspect your code requires an earlier version...?

Contributor

cowwoc commented Oct 19, 2011

Hi Timo,

Can you put out a SNAPSHOT build for me to try? When I tried building the project here I got this compiler error:

querydsl-core\src\main\java\com\mysema\util\ResultSetAdapter.java:[20,7] error: ResultSetAdapter is not abstract and does not override abstract method getObject(String,Class) in ResultSet

I only have JDK 1.7 installed. I suspect your code requires an earlier version...?

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 20, 2011

Member

Try this : 2.2.3.BUILD-SNAPSHOT

Member

timowest commented Oct 20, 2011

Try this : 2.2.3.BUILD-SNAPSHOT

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 23, 2011

Member

Released in 2.2.4

Member

timowest commented Oct 23, 2011

Released in 2.2.4

@timowest timowest closed this Oct 23, 2011

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Oct 24, 2011

Contributor

Was 2.2.4 released to Maven Central?

Contributor

cowwoc commented Oct 24, 2011

Was 2.2.4 released to Maven Central?

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 24, 2011

Member

Not yet. It takes some with the sync.

Member

timowest commented Oct 24, 2011

Not yet. It takes some with the sync.

@cowwoc

This comment has been minimized.

Show comment
Hide comment
@cowwoc

cowwoc Oct 27, 2011

Contributor

I think something went wrong. 2.2.4 never made it out. It's been three days since this issue was closed.

Contributor

cowwoc commented Oct 27, 2011

I think something went wrong. 2.2.4 never made it out. It's been three days since this issue was closed.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 27, 2011

Member

I will look into this later today.

Timo

On Thu, Oct 27, 2011 at 7:39 AM, cowwoc <
reply@reply.github.com>wrote:

I think something went wrong. 2.2.4 never made it out. It's been three days
since this issue was closed.

Reply to this email directly or view it on GitHub:
#26 (comment)

Timo Westkmper timo.westkamper@mysema.com
Mysema Oy, Vilhonkatu 5 A, FIN-00100 Helsinki, Finland
+358 (0)40 591 2172
http://www.mysema.com

Member

timowest commented Oct 27, 2011

I will look into this later today.

Timo

On Thu, Oct 27, 2011 at 7:39 AM, cowwoc <
reply@reply.github.com>wrote:

I think something went wrong. 2.2.4 never made it out. It's been three days
since this issue was closed.

Reply to this email directly or view it on GitHub:
#26 (comment)

Timo Westkmper timo.westkamper@mysema.com
Mysema Oy, Vilhonkatu 5 A, FIN-00100 Helsinki, Finland
+358 (0)40 591 2172
http://www.mysema.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment