Gradle equivalent of maven-dependency-plugin -
my root problem when running "spring-test"-based tests controllers , freemarker views need have taglibs inside web-inf/lib folder - otherwise freemarker not find them during tests. solved issue following piece of maven configuration. copies taglibs jars src/main/webapp/web-inf/lib folder before running tests. don't want clear folder since problem same when running test ide.
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version>2.3</version> <executions> <!-- freemaarker requires taglibs should reside in web-inf/lib folder --> <execution> <id>tests</id> <phase>test-compile</phase> <goals> <goal>copy</goal> </goals> <configuration> <outputdirectory>${basedir}/src/main/webapp/web-inf/lib/</outputdirectory> <artifactitems> <artifactitem> <groupid>org.springframework.security</groupid> <artifactid>spring-security-taglibs</artifactid> <version>${spring.security.version}</version> </artifactitem> </artifactitems> </configuration> </execution> </executions> </plugin>
now i'm migrating project gradle. how can achieve same gradle?
here how solved problem (the same in maven actually):
add configuration dependencies:
configurations{ taglibs { transitive = false } }
add needed dependency configuration:
dependencies { ... taglibs "org.springframework.security:spring-security-taglibs:$springsecurityversion" ... }
add gradle code copy these dependencies required folder:
task copytaglibs << { copy { configurations.taglibs 'src/main/webapp/web-inf/lib' } } compiletestjava{ dependson copytaglibs }
this it.
Comments
Post a Comment