buildr(2)First Project

本文详细介绍了如何使用Buildr构建一个多语言项目,包括目录结构设置、依赖管理、构建过程、测试自动化和自定义任务。文章还讨论了如何解决下载依赖时遇到的问题,并提供了针对不同场景的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

buildr(2)First Project

1. buildfile
create a directory named killer-app
>sudo buildr

That will generate a buildfile in your current directory. The directory structure is as follow:
src/main/java/
src/main/scala/
src/main/groovy/
src/main/resources/

target/classes/
target/resources/

>sudo buildr compile

error message:
Requesting http://www.ibiblio.org/maven2/org/apache/ant/ant/1.8.0/ant-1.8.0.jar
Buildr aborted!
RuntimeError : Failed to download org.apache.ant:ant:jar:1.8.0, tried the following repositories:
http://www.ibiblio.org/maven2/
solution:
change the repository to our nexus or artifactory:
repositories.remote << "http://server:port/repository" It is right now.

2. Packaging
define 'killer-app' do
project.version = '0.1.0'
package :jar
end

>sudo buildr package
>sudo buildr clean package

3. Dependencies
# Specify Maven 2.0 remote repositories here, like this:
repositories.remote << "http://www.ibiblio.org/maven2/"

This repositories.remote can be a array.

The format of artifact will be groupId:artifactId:packageType:version. The artifacts are as follow:

we can search the artifact at this URL http://www.mvnbrowser.com
...snip...
package :jar
compile.with 'commons-lang:commons-lang:jar:2.4'
compile.with 'commons-logging:commons-logging:jar:1.1.1'
compile.with 'commons-configuration:commons-configuration:jar:1.5'
...snip...

compile with comma.

WICKET = transitive('org.apache.wicket:wicket:jar:1.4-rc6')
SLF4J = 'org.slf4j:slf4j-jdk14:jar:1.5.8'

...snip...
compile.with WICKET, SLF4J
...snip...

buildr can actually download the zip file and dig into the downloaded archive, detect and extract the JAR file, installing it into the local repository just like any other artifact:

DBPOOL = 'net.snaq:dbpool:jar:4.8.3'
download artifact(DBPOOL) => 'http://www.snaq.net/java/DBPool/DBPool_v4.8.3.zip'

4. Testing
Buildr supports auto-magical integration with a number of mainstream testing frameworks.
JAVA Junit4, TestNG
Scala Specs, ScalaTest
Groovy EasyB

The directory for testing is as follow:
src/test/java/

run the test cases with this command
>sudo buildr test

with the dependencies like this as same as compile
...snip...
compile.with 'commons-cli:commons-cli:jar:1.2'
test.with 'commons-collections:commons-collections:jar:3.2'
...snip...

Using testng
...snip...
test.with 'commons-collections:commons-collections:jar:3.2'
test.using :testgn
...snip...

5. Custom Tasks
//TODO

references:
http://buildr.apache.org/quick_start.html#first-project
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值