Skip to content
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

Missing source folders are added to classpath #186

Closed
dsyer opened this issue Jul 12, 2016 · 12 comments
Closed

Missing source folders are added to classpath #186

dsyer opened this issue Jul 12, 2016 · 12 comments
Assignees

Comments

@dsyer
Copy link

dsyer commented Jul 12, 2016

So Eclipse moans constantly about missing source folders (src/main/groovy for example when Groovy is only being used for tests). It looks like this connector is adding stuff to the .classpath for folders that don't exist.

@kdvolder
Copy link
Contributor

A sample project would really help. I beleave there's a many different ways to configure the greclipse compiler via pom. So knowing exactly what a project exhibiting this problem looks like would be nice.

@kdvolder
Copy link
Contributor

I've created a sample project in the following way:

  1. Use initializr (aka New Spring Starter Project) Wizard to create a spring-boot + groovy project.
  2. Delete the source/main/groovy folder

The error then appears. The error does not get fixed by refreshing maven project or even deleting project, all project eclipse metadata and reimporting.

Then I also tested if perhaps we could just remove some of the goals from the pom (i,e, the ones related to 'src/main/groovy' like 'addSources', 'generateStubs' and 'compile'. I did this as it seems reasonable that if project is only using groovy in test it would not have those goals.

Even after that, the error persists. So there is definitely something wrong here.

@kdvolder kdvolder self-assigned this Jul 12, 2016
@dsyer
Copy link
Author

dsyer commented Jul 12, 2016

All of the samples here: https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples. I had to put ".empty" files in src/main/groovy to make them behave. You don't need any of the dependencies. Just copy the rest of the pom.

@kdvolder
Copy link
Contributor

Thanks that gives me a set of test samples to work with and make sure it behaves.

@kdvolder
Copy link
Contributor

kdvolder commented Jul 12, 2016

This is the bit that matters:

        <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>

Interesting... when I make a project with this kind of config it does NOT add the groovy sources folder. So in principle these project should work fine.

What I do see however is that the gmavenplus-based configurator never removes the paths when they are already there. So if the eclipse metadata was already present in the projects, then even after remove 'compile' (and related) goals, the main groovy source folder will not be removed.

If its manually removed however it stays gone upon refresh. Same if we delete the metadata and reimport project.

I'll make some adjustments to how this works so that:

a) source folders with paths controlled by the configurator are removed if their respective goals are missing.

b) source folders that do not actually exist will never be added.

That should make doubly sure this works correctly.

@kdvolder
Copy link
Contributor

kdvolder commented Jul 12, 2016

@dsyer You can try updating the m2e configurator from snapshot site. Fix should be there now.

http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/

@reckart
Copy link

reckart commented Aug 2, 2016

Is this fix also included in 2.9.2.xx-201607251752-e45 ?

@kdvolder
Copy link
Contributor

kdvolder commented Aug 9, 2016

Probably not. The e45 build has not run to completion in a long time:
https://build.spring.io/browse/GRECLIPSE-GE45

@reckart
Copy link

reckart commented Aug 9, 2016

@kdvolder well, that snapshot build needs to have come from somewhere. It includes a timestamp. So somebody seems to have run a successful build on 2016-07-25 at 17:52, right? If it wasn't the build system, then maybe somebody did a local build and uploaded that?

@kdvolder
Copy link
Contributor

kdvolder commented Aug 9, 2016

Actually inspecting the logs for snapshot build more closely. It did run to completion. Looks like the only reason for the 'red' icons in bamboo is that someone disabled the tests. Bamboo is expecting test results and can't find them and so it shows the build status as 'failed'.

So, yes, that build should include the fix.

@kdvolder
Copy link
Contributor

kdvolder commented Aug 9, 2016

I've updated the bamboo config for e45 build to reflect reality. I.e.

  • bamboo should not be expecting test results
  • changed name of the build to 'build and publish' instead of 'build, test and publish'.

@jjurkiewicz
Copy link

jjurkiewicz commented Aug 12, 2016

Hello,

I started looking into the commit that fixes this issue and it looks that it might have introduced an issue described in #192.
When I started debugging the issue in a project with gmaven plugin configured it looks that the src/test/groovy is getting removed from the classpath.
It looks that in my project I have configured both gmaven (in parent pom) and gmaven-plus (in the actual pom I define). And the goal for the gmaven plugin is set to execute, hance the Sourcetype is set to NONE and it is causing the problem. One of the solutions would be to make sure that in the GroovyProjectConfigurator#getSourceType method we don't return straight away after checking the gmaven plugin, but keep checking all the other plugins too. Does it may sense? If yes, I am happy to contribute a fix.

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

No branches or pull requests

4 participants