Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362606 - Dependency on sources after main artifact disables main artifact
Summary: Dependency on sources after main artifact disables main artifact
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-01 19:23 EDT by Alex Pogrebnyak CLA
Modified: 2021-04-19 13:22 EDT (History)
1 user (show)

See Also:


Attachments
working example (1.19 KB, application/zip)
2011-11-02 05:43 EDT, Igor Fedorenko CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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/