Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362606

Summary: Dependency on sources after main artifact disables main artifact
Product: z_Archived Reporter: Alex Pogrebnyak <alex-pub.eclipse>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: igor
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
working example none

Description Alex Pogrebnyak CLA 2011-11-01 19:23:28 EDT
I am going through Spring Roo tutorial, and one of the topics is setting up GWT project.

GWT requires some source files to be present as dependencies of the maven project, as such it requires javax.validation:validation-api:1.0.0.GA:sources artifact.

The project already had a dependency on a main 'jar' artifact of the validation-api.

After Roo modified POM and added 'sources' jar at the end of the dependencies list, I could no longer import classes from javax.validation.constraints package. In particular javax.validation.constraints.NotNull annotation.

After I've rearranged dependencies, so that main artifact comes after sources, e.g.

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier/>
        </dependency>

The project compiles without errors.

If I again reverse the order

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier/>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
        </dependency>

the fields annotated with @NotNull show up in red.
Comment 1 Alex Pogrebnyak CLA 2011-11-01 19:34:15 EDT
Actually, with configuration that compiles java code, i.e 

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier/>
        </dependency>

I get an error from GWT server:

19:30:49.356 [ERROR] [applicationScaffold] Line 97: No source code is available for type javax.validation.ConstraintViolation<T>; did you forget to inherit a required module?
Comment 2 Igor Fedorenko CLA 2011-11-02 05:43:04 EDT
Created attachment 206317 [details]
working example

Using clean m2e install, the attached example properly has both both jar and sources-jar dependencies under Maven Dependencies classpath container. Most likely the problem you observed is caused by one of m2e extensions you use. If you believe the problem is cased by m2e itself, feel free to reopen this bugreport but make sure to provide complete standalone example we can use to reproduce the problem using eclipse 3.7 "for java developers" package available from download.eclipse.org
Comment 3 Denis Roy CLA 2021-04-19 13:22:00 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/