felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: [Fwd: Re: building a felix embedding web app with maven]
Date Thu, 16 Oct 2008 14:12:29 GMT
I modified the framework's dependency on compendium to exclude 
compendium's servlet dependency. I think this makes more sense than 
marking the servlet dependency as optional in compendium. My reasoning 
is that compendium does have a dependency on servlet, but framework has 
no such dependency, so it make sense to exclude it in framework.

Hopefully this will be helpful for people just using the framework JAR 
in the future.

-> richard

Stuart McCulloch wrote:
> 2008/10/8 Richard S. Hall <heavy@ungoverned.org>
>
>   
>> Richard S. Hall wrote:
>>
>>     
>>> I guess servlet gets dragged into the framework dependencies from
>>> compendium. Should we put excluding servlet in our own POMs? Would it
>>> excluding it in the framework POM be sufficient?
>>>
>>>       
>> Wow. This message is unreadable.
>>
>> "Should we exclude servlet in our own POMs? Would excluding it in the
>> framework POM be sufficient?"
>>
>>     
>
> another approach is to mark the dependency as:
>
>    <optional>true</optional>
>
> in the compendium pom - this tells Maven to use it when compiling the
> project, but not to include it when calculating transitive dependencies
>
> see:  http://maven.apache.org/pom.html#Dependencies
>
>   "optional:
>
>    Marks optional a dependency when this project itself is a dependency.
>    Confused? For example, imagine a project A that depends upon project
>    B to compile a portion of code that may not be used at runtime, then we
>    may have no need for project B for all project. So if project X adds
> project
>    A as its own dependency, then Maven will not need to install project B at
> all.
>
>    Symbolically, if => represents a required dependency, and --> represents
>    optional, although A=>B may be the case when building A X=>A-->B would
>    be the case when building X.
>
>    In the shortest terms, optional lets other projects know that, when you
> use
>    this project, you do not require this dependency in order to work
> correctly."
>
> HTH
>
> -> richard
>   
>>> -> richard
>>>
>>> -------- Original Message --------
>>> Subject:     Re: building a felix embedding web app with maven
>>> Date:     Wed, 8 Oct 2008 17:08:49 +0800
>>> From:     Stuart McCulloch <mcculls@gmail.com>
>>> Reply-To:     users@felix.apache.org
>>> To:     users@felix.apache.org
>>> References: <
>>> OFCCA70B5C.64DDF772-ONCA2574DC.00289F6B-CA2574DC.002A02B1@qbe.com>
>>>
>>>
>>>
>>> 2008/10/8 Maxim Suponya <maxim.suponya@qbe.com>
>>>
>>>  Hi,
>>>       
>>>> I have a web app that is built using maven 2.0.8. The application's
>>>> pom.xml contains following dependency:
>>>>
>>>>     <dependency>
>>>>       <groupId>org.apache.felix</groupId>
>>>>       <artifactId>org.apache.felix.framework</artifactId>
>>>>       <version>1.2.1</version>
>>>>     </dependency>
>>>>
>>>> But felix, in turn, depends on a project defined in
>>>> javax.servlet-1.0.0.pom which subsequently makes a jar file called
>>>> javax.servlet-1.0.0.jar ending up in WEB-INF/lib together with
>>>> org.apache.felix.framework-1.2.1.jar.
>>>>
>>>>         
>>> have you tried using:
>>>
>>>    <dependency>
>>>      <groupId>org.apache.felix</groupId>
>>>       <artifactId>org.apache.felix.framework</artifactId>
>>>      <version>1.2.1</version>
>>>      <exclusions>
>>>        <exclusion>
>>>          <groupId>org.apache.felix</groupId>
>>>          <artifactId>javax.servlet</artifactId>
>>>        </exclusion>
>>>      </exclusions>
>>>    </dependency>
>>>
>>> to tell Maven to exclude the transitive servlet dependency?
>>>
>>>
>>>  When the web application starts and the servlet that launches felix gets
>>>       
>>>> initialized, a ClassCastException is thrown saying that this servlet is
>>>> not a Servlet.. this is due to presence of javax.servlet-1.0.0.jar with
>>>> Servlet.class in WEB-INF/lib which comes in conflict with the one that's
>>>> provided by Tomcat.
>>>>
>>>> Adding <scope>provided</scope> in my app's pom.xml doesn't make
any
>>>> difference.
>>>>
>>>>     <dependency>
>>>>       <groupId>org.apache.felix</groupId>
>>>>       <artifactId>javax.servlet</artifactId>
>>>>       <version>1.0.0</version>
>>>>       <scope>provided</scope>
>>>>     </dependency>
>>>>
>>>> Is there any way around this?
>>>>
>>>> Thanks a lot,
>>>>
>>>> Maxim
>>>>
>>>> - ----------------
>>>> IMPORTANT NOTICE : The information in this email is confidential and may
>>>> also be privileged. If you are not the intended recipient, any use or
>>>> dissemination of the information and any disclosure or copying of this
>>>> email
>>>> is unauthorised and strictly prohibited. If you have received this email
>>>> in
>>>> error, please promptly inform us by reply email or telephone. You should
>>>> also delete this email and destroy any hard copies produced.
>>>>
>>>>         

Mime
View raw message