History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-17064
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Assignee: Anton Makeev
Reporter: Alin Dreghiciu
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

IDEA does not handle <optional> dependency tag

Created: 05 Feb 08 08:03   Updated: 11 Apr 08 15:08
Component/s: Maven Integration

Issue Links:
Duplicate
This issue duplicates:
IDEA-17666 Maven dependencies scope not working ... Open
 

Build: 7,590
Severity: High


 Description  « Hide
in the pom file of a project you can mark a dependency as optional by using tag <optional>true</optional>. This in combination with a <scope>compile</scope> means that the dependency is NOT transitive.
The problem is that IDEA does not take in count this when computing the dependency and adds the dependency marked as optional to the list of available jars in the classpath and so a class could compile in idea but not when doing the maven build.

More, while using Maven to build osgi artifacts this option is used quite heavily.



 All   Comments   Work Log   Change History      Sort Order:
Anton Makeev - 05 Feb 08 17:10
What is the problem this case causes?
Could you please give some concrete example?

Alin Dreghiciu - 06 Feb 08 08:58
A simple example:
1. I have project A that has a dependency on project B
2. The dependency on project B is marked as optional with <optional>true</optional> and <scope>compile</compile> => B is not transitive in Maven terms
3. I have a project C that depends on project B
4. Now, if I'm in IDEA project B will be added to the list of modules libraries. This means that I can use anything within project B and that will compile within IDEA. But, if I run a maven build I will get an ClassNotFoundException as maven it will not add project B to classpath as project B is not considered transitive by Maven.

For use cases of such usage you may take a look at http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html.


Anton Makeev - 07 Feb 08 16:07
I'm afraid IDEA does not support optional inter-module dipendencies. The classpath is build transitively irrelatively the export flag.
We will handle the <optional> tag and set the export flag accordingly. This functonality will be available in the fist 7.0.4 eap.

If you have some problem running your apps from IDEA, please elaborate the details.


Anton Makeev - 11 Apr 08 15:08