Hi Kasun, +1 on the suggested solution. Can you please provide the maven plugin configuration when we have jars that are not defined as dependencies?
thank you. On Wed, Oct 7, 2015 at 5:50 PM, Kasun De Silva <kas...@wso2.com> wrote: > I'm currently working on [1], and the issue can be describe as below. > > AF/AppCloud provides maven webapp archetype with preconfigured maven war > plugin, and we'll get following archetype structure, > > ├── pom.xml > ├── src > │ └── main > │ ├── resources > │ └── webapp > │ ├── index.jsp > │ ├── META-INF > │ └── WEB-INF > │ ├── classes > │ ├── lib > │ └── web.xml > └── target > ├── classes > ├── sample_app.war > └── surefire > > Executing following steps will reproduce the issue against the above app, > > 1. Add a dependency to the pom.xml and build it. Check the war file and > you will see the jar there. > 2. Change the version of above dependency. Lets assume previous version is > 1.0.0 and new one is 2.0.0. Build again. > 3. When you check the built war file, you will see both versions inside it. > > The reason for this behavior is, with the maven war plugin, there is a > webapp folder created. When we build the app, there is a *WEB-INF/lib* > directory > created inside that one and the jars (dependencies) are copied to it. > > └── WEB-INF > │ ├── classes > │ ├── lib > │ │ └── dependancy-1.0.0.jar > │ └── web.xml > > After executing the second step, > > └── WEB-INF > │ ├── classes > │ ├── lib > │ │ ├── dependancy-1.0.0.jar > │ │ └── dependancy-2.0.0.jar > │ └── web.xml > > When we rebuild (even with a maven clean install), those jars are not > getting cleaned and new jars are added. > > Even when we remove these dependancies from pom.xml this jars will still > exists and will result in adding unnecessary jars into the artifact. > > A possible solution would be we can add a maven clean plugin and clean the > content on the *WEB-INF/lib *directory while doing the mvn:clean. > > But what if the user has other libraries and other content which are not > added by maven dependencies and still required. In that case we > can exclude [2] those in maven clean plugin. > > WDYT about the this solution ? Or are there any possible solutions to > prevent this behavior ? > > > > [1] https://wso2.org/jira/browse/APPFAC-3482 > > > Thanks, > Kasun > > *Kasun de Silva* > Software Engineer | *WSO2 Inc.*; http://wso2.com > lean.enterprise.middleware > > email : kas...@wso2.com > mobile : +94 77 794 4260 > > -- Manjula Rathnayaka Associate Technical Lead WSO2, Inc. Mobile:+94 77 743 1987
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev