[jbosscache-dev] Re: Add a 'JBossAS' profile to pom.xml for PojoCache

Galder Zamarreno galder.zamarreno at redhat.com
Fri Mar 7 12:09:11 EST 2008



Brian Stansberry wrote:
> Galder Zamarreno wrote:
>>
>>
>> Brian Stansberry wrote:
>>> Re: #1, a bit ugly but doesn't surprise me the problem exists. It 
>>> would be tricky for maven to understand that cache-core 
>>> 2.1.0.CR4-JBossAS came from cache-core's JBossAS profile and know to 
>>> use that profile's dependencies.
>>
>> That would be tricky, but look at it the other way around. When you do 
>> the following on cache-core:
>>
>> mvn -PJBossAS install
>>
>> maven should be realise that it needs to build a pom based on a 
>> mixture of dependencies defined in the main project and the ones i've 
>> redefined in the profile. For example:
>>
>> cache-core's pom.xml defines:
>>
>>       <dependency>
>>          <groupId>org.jboss.javaee</groupId>
>>          <artifactId>jboss-javaee</artifactId>
>>          <version>5.0.0.Beta3</version>
>>       </dependency>
>> ...
>>       <dependency>
>>          <groupId>jdbm</groupId>
>>          <artifactId>jdbm</artifactId>
>>          <version>1.0</version>
>>          <optional>true</optional>
>>       </dependency>
>>
>> After doing mvn -PJBossAS install, the generated pom.xml 
> 
> What's put in the repository is a "generated" file? If it is, sure, what 
> you say makes sense. If it's not, the idea of having it be generated is 
> definitely interesting too.  

Good question. I don't know whether it's a generated pom, or the pom of 
the project as is. I'll have a look at what the Maven source code does.

 > But be careful, you're sliding into the maven rabbit hole. ;)

hehehehe, I'll make sure I don't get exposed to the source code for too 
long...

> 
>> should realise that I've redefined the jboss-javaee dependency in the 
>> profile and so the resulting pom.xml for 
>> jbosscache-core-2.1.0-SNAPSHOT-JBossAS should have:
>>
>>       <dependency>
>>          <groupId>org.jboss.javaee</groupId>
>>          <artifactId>jboss-javaee</artifactId>
>>          <version>5.0.0.Beta3Update1</version>
>>       </dependency>
>> ...
>>       <dependency>
>>          <groupId>jdbm</groupId>
>>          <artifactId>jdbm</artifactId>
>>          <version>1.0</version>
>>          <optional>true</optional>
>>       </dependency>
>>
>> Maven doesn't do this, so the dependencies are exactly as they're 
>> originally, which forces to re-definition in pojo cache.
>>
>>>
>>> Re #2, I'll let Jason comment on what's up with the aop plugin, but 
>>> the idea of using properties to specify versions doesn't seem so 
>>> bad.  I've seen the same done in ejb3 and hibernate.
>>>
>>> Thanks for sorting this!
>>>
>>> Galder Zamarreno wrote:
>>>> Hi,
>>>>
>>>> Re: http://jira.jboss.com/jira/browse/PCACHE-60
>>>>
>>>> I've been playing around with this JIRA and there's a couple of 
>>>> things I've noted:
>>>>
>>>> 1.- When we build cache-core with JBossAS profile, the generated pom 
>>>> file still points to the original dependencies, which means that in 
>>>> the cache-pojo's pom.xml, we have to repeat the cache-core 
>>>> dependencies for JBossAS profile.
>>>>
>>>> If a project depends on library A-1.0.0.GA and the profile specifies 
>>>> dependency on A-1.0.0.SP1, you'd expect that any build artifacts 
>>>> generated, i.e. pom.xml, would have main dependency switched to 
>>>> A-1.0.0.SP1 but it doesn't. So, you have built a new jar with 
>>>> profile dependencies but when it's used by another project, it still 
>>>> downloads original dependencies.... useless. I'm gonna follow this 
>>>> up with Maven users and see what I can find.
>>>>
>>>> For the time being, until I've found a better solution, dependencies 
>>>> in JBossAS profile in cache-core will be repeated in cache-pojo.
>>>>
>>>> 2.- As cache-pojo's pom.xml says about the maven jbossaop plugin, 
>>>> "    <!-- HACK: AOP project and plugin has broken deps -->", the 
>>>> dependencies for jbossaop are broken, so we have to repeat them. 
>>>> This has a direct effect on creating a brand new profile for JBossAS.
>>>>
>>>> Even though I've updated JBossAS dependencies, I need to add similar 
>>>> dependencies to the maven-jbossaop-plugin in order for aopc to 
>>>> happen with the desired dependencies.
>>>>
>>>> Now, in a profile, you can't override the following section of the 
>>>> main pom.xml:
>>>>
>>>> <build>
>>>>   <plugins>
>>>> ...
>>>>
>>>> This means that I need to define all JBoss AOP dependencies for 
>>>> maven-jbossaop-plugin that we might want to override in JBossAS 
>>>> profile. For example jboss-javaee, microcontainer...etc using 
>>>> properties and define the versions at the top of the pom.xml and 
>>>> then define these same properties for JBossAS profile. For example:
>>>>
>>>>   <properties>
>>>>     <jbosscache-pojo-version>2.1.0.CR4</jbosscache-pojo-version>
>>>>     <jbosscache-core-version>2.1.0.CR4</jbosscache-core-version>
>>>>     <jboss.aop.version>2.0.0.CR3</jboss.aop.version>
>>>>
>>>> <jboss.microcontainer.version>2.0.0.Beta6</jboss.microcontainer.version> 
>>>>
>>>>   </properties>
>>>> ...
>>>>         <groupId>org.jboss.maven.plugins</groupId>
>>>>         <artifactId>maven-jbossaop-plugin</artifactId>
>>>>         <version>2.0.0.beta1</version>
>>>> ...
>>>>             <dependency>
>>>>                <groupId>org.jboss.microcontainer</groupId>
>>>>                <artifactId>jboss-container</artifactId>
>>>>                <version>${jboss.microcontainer.version}</version>
>>>>             </dependency>
>>>> ...
>>>>    <profiles>
>>>>       <profile>
>>>>          <id>JBossAS</id>
>>>>          <activation>
>>>>             <activeByDefault>false</activeByDefault>
>>>>          </activation>
>>>>          <properties>
>>>>
>>>> <jbosscache-pojo-version>2.1.0.CR4-JBossAS</jbosscache-pojo-version>
>>>>
>>>> <jbosscache-core-version>2.1.0-SNAPSHOT-JBossAS</jbosscache-core-version> 
>>>>
>>>>             <jboss.aop.version>2.0.0.CR7</jboss.aop.version>
>>>> <jboss.microcontainer.version>2.0.0.Beta10</jboss.microcontainer.version> 
>>>>
>>>> ...
>>>>
>>>> Having to do this is a royal pain in the butt and can lead to 
>>>> incorrect version definitions. Thoughts? Has anyone looked into 
>>>> fixing the broken maven aop plugin?
>>>>
>>>> Cheers,
>>>
>>
> 

-- 
Galder Zamarreño
Sr. Software Maintenance Engineer
JBoss, a division of Red Hat



More information about the jbosscache-dev mailing list