Priority
Normal
Type
Bug 
State
Duplicate 
Assignee
Anton Makeev 
Subsystem
Maven Integration 
Affected versions
Fixed in
Fixed in build Next build
Build
7590
Severity
0
  • Submitted by   Alin Dreghiciu
    2 years ago (05 Feb 2008 08:03)
  • Updated by Alin Dreghiciu
    21 months ago (11 Apr 2008 15:08)
  • Jira: IDEA-17064
    (history, comments)

IDEA-17064

IDEA does not handle <optional> dependency tag

0
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.

Issue was closed
Comments (4)
 
History (0)
 
Links
 
Anton Makeev
  Anton Makeev
05 Feb 2008 17:10
(2 years ago)
#permalink
What is the problem this case causes?
Could you please give some concrete example?
Alin Dreghiciu
  Alin Dreghiciu
06 Feb 2008 08:58
(2 years ago)
#permalink
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
  Anton Makeev
07 Feb 2008 16:07
(2 years ago)
#permalink
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
  Anton Makeev
11 Apr 2008 15:08
(21 months ago)
#permalink
IDEA-17666