首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用"ant“命令(在SQLServer2008Express上构建*.sql本体数据库)按顺序从XML文件中运行i2b2文件?

使用"ant“命令(在SQLServer2008Express上构建*.sql本体数据库)按顺序从XML文件中运行i2b2文件?
EN

Stack Overflow用户
提问于 2012-05-06 09:38:00
回答 2查看 4.4K关注 0票数 1

下面是i2b2数据库设置教程中用于创建一组表并为特定数据库加载数据的命令。我以前只在(SSMS)中手动运行*.sql命令(在一个新的查询窗口中)。这是必须从Java运行的东西,还是可以直接在某个命令提示符中执行呢?如果是的话,你能帮我做必要的步骤吗?(我需要引用第三方程序集吗?我猜我需要配置我的数据库连接字符串等等)

代码语言:javascript
复制
ant –f data_build.xml create_workdata_tables_release_1-6

ant –f data_build.xml db_workdata_load_data

在盘旋在"ant“(StackOverflow标记)之后,它似乎是某种Java。

Apache Ant (以前的Jakarta )是一个声明式的、基于XML的Java项目构建工具。它为执行最常见的构建操作提供了一组丰富的标准任务,例如用javac编译、构建归档文件和运行测试。Ant的功能可以通过自定义任务和宏来扩展。

我试图在Windows中的命令提示符中运行这个命令,但得到了一个错误。

代码语言:javascript
复制
C:\Source\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\Metadata>ant -f data_build.xml create_crcdata_tables_release_1-6
'ant' is not recognized as an internal or external command,
operable program or batch file.

我看到了XML文件中列出的实际*.sql文件,我猜它们是以特定的方式排序的,这样关联的(包含主键)首先将数据加载到它们中,桥/父/所有者/基表(包含外键)最后运行,因为它们依赖于关联的表。如果所有其他命令都失败了,我可能可以按照所列的顺序直接从SSMS运行这些命令,但我很想尝试一下这个"ant“命令。

安装说明:

http://www.i2b2.org

下载"i2b2createdb-1602.zip“并解压。

下载"i2b2core-doc-1602.zip“并提取(使用这些PDF文档获取安装说明)

=====================================

看来,我必须定义XML文件中定义的变量。

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Id: data_build.xml,v 1.5 2010/06/04 15:33:06 lcp5 Exp $
-->
<project name="Ontology/Metadata data" basedir=".">

    <property environment="env" />

    <property file="./db.properties" />

    <!-- =================================================================== -->
    <!--                                INIT                                 -->
    <!-- =================================================================== -->
    <target name="init"  description="Prepare for build">
        <path id="classpath">
            <pathelement location="../ojdbc14.jar" />
            <pathelement location="../sqljdbc.jar"/>
        </path>
    </target>



    <!-- =================================================================== -->
    <!--            DATABASE SETUP TARGETS                                   -->
    <!-- =================================================================== -->
    <target name="db_create_user" depends="init">
        <sql driver="${db.driver}" url="${db.url}" userid="${db.username}" password="${db.password}" classpathref="classpath" onerror="continue" print="true">
                    CREATE USER  i2b2metadata IDENTIFIED BY   i2b2metadata;
                </sql>
    </target>

    <target name="create_metadata_tables_release_1-6" depends="init">
        <sql driver="${db.driver}" url="${db.url}" userid="${db.username}" password="${db.password}" classpathref="classpath" onerror="continue" print="true">
            <transaction src="./scripts/create_${db.type}_i2b2metadata_tables.sql" />
        </sql>
    </target>

    <target name="db_metadata_load_data" depends="init">
        <echo message="Loading metadata -- may take a while; over 10 min" />
        <sql driver="${db.driver}" url="${db.url}" userid="${db.username}" password="${db.password}" classpathref="classpath" onerror="continue" print="true">
            <transaction src="./${db.project}/scripts/schemes_insert_data.sql" />
            <transaction src="./${db.project}/scripts/table_access_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/birn_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/custom_meta_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_demographics_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_diagnoses_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_expressions_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_labtests_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_medications_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_modifiers_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_procedures_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_providers_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_reports_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_visitDetails_insert_data.sql" />
        </sql>
    </target>

</project>

=====================================

2012年6月5日@6:52上午:

设置:

  • >创建名为"i2b2_demo"

的新数据库

安装Oracle:

  • http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html

安装Apache:

http://ant.apache.org/

  • navigate下载二进制文件到此路径以获得安装说明:手动>安装Apache >获取Ant > ..follow

  • 提取的文件夹(包含bin文件夹)在C:\source_code\apache-ant-1.8.3\或%ANT_HOME%环境变量

中使用的目录

Java和Ant:环境变量设置

Windows 7>控制面板>系统>单击“环境变量”按钮>

(别忘了尾随的"\") *_MacGyver 5/6/2012 @2:45下午-忽略这个.删除后面的"\“字符..。参见下面question_中的评论

在“系统变量”部分,单击“添加”>变量名称:JAVA_HOME变量值:C:\Program Files\Java\jdk1.7.0_02\

在“系统变量”部分,单击“添加”>变量名称:ANT_HOME变量值:C:\source_code\apache-ant-1.8.3\

在“系统变量”部分,单击“路径”环境变量,单击“编辑”>变量名称:Path变量值:{value before editing};%JAVA_HOME%\bin;%ANT_HOME%\bin;

Administrator)

  • replace

  • 重新启动命令提示符(以形式运行,每个C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\{folder}\db.properties文件都具有适当的值。替换"?“具有正确值的.

"db.properties“文件:

代码语言:javascript
复制
db.type=sqlserver
db.username=?
db.password=?
db.server=LAPTOP-INSPIRON\SQLEXPRESS
db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.url=jdbc:sqlserver:LAPTOP-INSPIRON\SQLEXPRESS;databasename=i2b2_demo
db.project=demo

获取此错误:

代码语言:javascript
复制
C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInsta
ll\Crcdata>ant -f data_build.xml upgrade_metadata_tables_release_1-6
Buildfile: build.xml does not exist!
Build failed

=====================================

2012年6月5日@7:33找到了这个错误页面..。

安装Ant:

单击以下命令:http://ant.apache.org/manual/index.html

或者..。

导航到http://ant.apache.org/ >手动>安装Apache > Installing >

代码语言:javascript
复制
C:\source_code\apache-ant-1.8.3>ant -version
Apache Ant(TM) version 1.8.3 compiled on February 26 2012

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:70: ERROR
Set -Ddest=LOCATION on the command line
  -Ddest=user     user lib dir  C:\Users\Keith/.ant/lib
  -Ddest=system   ant lib dir   C:\source_code\apache-ant-1.8.3/lib
  -Ddest=optional optional dir  ${basedir}/lib/optional  (for Ant developers)

Total time: 0 seconds

C:\source_code\apache-ant-1.8.3>build install
'build' is not recognized as an internal or external command,
operable program or batch file.

.然后注意到我漏掉了命令中的参数。但还是失败了!

代码语言:javascript
复制
C:\source_code\apache-ant-1.8.3>ant -f fetch.xml -Ddest=system
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib

probe-m2:

download-m2:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib
      [get] Getting: http://repo1.maven.org/maven2/org/apache/maven/maven-artifa
ct-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar
      [get] To: C:\source_code\apache-ant-1.8.3\lib\maven-artifact-ant-2.0.4-dep
.jar
      [get] ...................................

dont-validate-m2-checksum:

validate-m2-checksum:

checksum-mismatch:

checksum-match:

get-m2:

macros:

init:

logging:
[artifact:dependencies] Downloading: log4j/log4j/1.2.14/log4j-1.2.14.pom
[artifact:dependencies] Transferring 2K
[artifact:dependencies] Downloading: log4j/log4j/1.2.14/log4j-1.2.14.jar
[artifact:dependencies] Transferring 358K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: commons-logging/commons-logging-api/1.1/com
mons-logging-api-1.1.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: commons-logging/commons-logging-api/1.1/com
mons-logging-api-1.1.jar
[artifact:dependencies] Transferring 43K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

junit:
[artifact:dependencies] Downloading: junit/junit/4.8.1/junit-4.8.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: junit/junit/4.8.1/junit-4.8.1.jar
[artifact:dependencies] Transferring 231K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

xml:
[artifact:dependencies] Downloading: xalan/xalan/2.7.1/xalan-2.7.1.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/apache/apache/4/apache-4.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: xalan/serializer/2.7.1/serializer-2.7.1.pom

[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.po
m
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/apache/apache/3/apache-3.pom
[artifact:dependencies] Transferring 3K
[artifact:dependencies] Downloading: xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.ja
r
[artifact:dependencies] Transferring 189K
[artifact:dependencies] Downloading: xalan/serializer/2.7.1/serializer-2.7.1.jar

[artifact:dependencies] Transferring 271K
[artifact:dependencies] Downloading: xalan/xalan/2.7.1/xalan-2.7.1.jar
[artifact:dependencies] Transferring 3101K
     [copy] Copying 3 files to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: xml-resolver/xml-resolver/1.2/xml-resolver-
1.2.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: xml-resolver/xml-resolver/1.2/xml-resolver-
1.2.jar
[artifact:dependencies] Transferring 82K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

networking:
[artifact:dependencies] Downloading: commons-net/commons-net/1.4.1/commons-net-1
.4.1.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: oro/oro/2.0.8/oro-2.0.8.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: oro/oro/2.0.8/oro-2.0.8.jar
[artifact:dependencies] Transferring 63K
[artifact:dependencies] Downloading: commons-net/commons-net/1.4.1/commons-net-1
.4.1.jar
[artifact:dependencies] Transferring 176K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: com/jcraft/jsch/0.1.42/jsch-0.1.42.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: com/jcraft/jsch/0.1.42/jsch-0.1.42.jar
[artifact:dependencies] Transferring 181K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

regexp:
[artifact:dependencies] Downloading: regexp/regexp/1.3/regexp-1.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.3/regexp-1.3.jar
[artifact:dependencies] Transferring 24K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

antlr:
[artifact:dependencies] Downloading: antlr/antlr/2.7.7/antlr-2.7.7.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: antlr/antlr/2.7.7/antlr-2.7.7.jar
[artifact:dependencies] Transferring 434K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

bcel:
[artifact:dependencies] Downloading: bcel/bcel/5.1/bcel-5.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.2/regexp-1.2.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.2/regexp-1.2.jar
[artifact:dependencies] Transferring 29K
[artifact:dependencies] Downloading: bcel/bcel/5.1/bcel-5.1.jar
[artifact:dependencies] Transferring 503K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib

jdepend:
[artifact:dependencies] Downloading: jdepend/jdepend/2.9.1/jdepend-2.9.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: jdepend/jdepend/2.9.1/jdepend-2.9.1.jar
[artifact:dependencies] Transferring 56K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

bsf:
[artifact:dependencies] Downloading: bsf/bsf/2.4.0/bsf-2.4.0.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: commons-logging/commons-logging/1.0.4/commo
ns-logging-1.0.4.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: commons-logging/commons-logging/1.0.4/commo
ns-logging-1.0.4.jar
[artifact:dependencies] Transferring 37K
[artifact:dependencies] Downloading: bsf/bsf/2.4.0/bsf-2.4.0.jar
[artifact:dependencies] Transferring 110K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib

debugging:
[artifact:dependencies] Downloading: which/which/1.0/which-1.0.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: which/which/1.0/which-1.0.jar
[artifact:dependencies] Transferring 16K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

jruby:
[artifact:dependencies] Downloading: org/jruby/jruby/0.9.8/jruby-0.9.8.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: org/jruby/shared/0.9.8/shared-0.9.8.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: asm/asm-commons/2.2.3/asm-commons-2.2.3.pom

[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm-parent/2.2.3/asm-parent-2.2.3.pom
[artifact:dependencies] Transferring 2K
[artifact:dependencies] Downloading: asm/asm-tree/2.2.3/asm-tree-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm/2.2.3/asm-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm-commons/2.2.3/asm-commons-2.2.3.jar

[artifact:dependencies] Transferring 14K
[artifact:dependencies] Downloading: org/jruby/jruby/0.9.8/jruby-0.9.8.jar
[artifact:dependencies] Transferring 1644K
[artifact:dependencies] Downloading: asm/asm/2.2.3/asm-2.2.3.jar
[artifact:dependencies] Transferring 34K
[artifact:dependencies] Downloading: asm/asm-tree/2.2.3/asm-tree-2.2.3.jar
[artifact:dependencies] Transferring 15K
     [copy] Copying 4 files to C:\source_code\apache-ant-1.8.3\lib

beanshell:
[artifact:dependencies] Downloading: org/beanshell/bsh/2.0b4/bsh-2.0b4.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/beanshell/beanshell/2.0b4/beanshell-2.0
b4.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
[artifact:dependencies] Transferring 275K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4
.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4
.jar
[artifact:dependencies] Transferring 140K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

rhino:
[artifact:dependencies] Downloading: rhino/js/1.6R7/js-1.6R7.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: rhino/js/1.6R7/js-1.6R7.jar
[artifact:dependencies] Transferring 794K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

script:

javamail:
[artifact:dependencies] Downloading: javax/mail/mail/1.4/mail-1.4.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: javax/activation/activation/1.1/activation-
1.1.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: javax/mail/mail/1.4/mail-1.4.jar
[artifact:dependencies] Transferring 379K
[artifact:dependencies] Downloading: javax/activation/activation/1.1/activation-
1.1.jar
[artifact:dependencies] Transferring 61K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib

jspc:
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.jar
[artifact:dependencies] Transferring 179K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.jar
[artifact:dependencies] Transferring 70K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: javax/servlet/servlet-api/2.3/servlet-api-2
.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: javax/servlet/servlet-api/2.3/servlet-api-2
.3.jar
[artifact:dependencies] Transferring 76K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

jai:
[artifact:dependencies] Downloading: javax/media/jai-core/1.1.3/jai-core-1.1.3.p
om
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: javax/media/jai-core/1.1.3/jai-core-1.1.3.j
ar
[artifact:dependencies] Transferring 1856K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: com/sun/media/jai-codec/1.1.3/jai-codec-1.1
.3.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: com/sun/media/jai-codec/1.1.3/jai-codec-1.1
.3.jar
[artifact:dependencies] Transferring 252K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

nonm2-macros:

init-no-m2:

init-cache:

-setup-temp-cache:
    [mkdir] Created dir: C:\Users\{user name}\.ant\tempcache

-fetch-netrexx:

-fetch-netrexx-no-commons-net:
      [get] Getting: ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRex
x.zip
      [get] To: C:\Users\{user name}\.ant\tempcache\NetRexx.zip
      [get] Error opening connection java.net.SocketException: Permission denied
: recv failed
      [get] Error opening connection java.net.SocketException: Connection reset
      [get] Error opening connection java.net.SocketException: Connection reset
      [get] Can't get ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRe
xx.zip to C:\Users\{user name}\.ant\tempcache\NetRexx.zip

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:328: Can't get ftp://ftp.software.ibm.
com/software/awdtools/netrexx/NetRexx.zip to C:\Users\{user name}\.ant\tempcache\NetRe
xx.zip

Total time: 49 seconds

=====================================

2012年6月5日@ 1:33pm更新

我读了这个片段,意识到我把"\“放在了两个环境变量(ANT_HOME & JAVA_HOME)的末尾。我想你不能这么做。是我的错。

视窗备注:

“ant.bat脚本使用了三个环境变量-- ANT_HOME、CLASSPATH和JAVA_HOME。确保设置了ANT_HOME和JAVA_HOME变量,并且它们没有引号(或者”或"),并且没有以\或/结尾。CLASSPATH应该是未设置或空的。“

  • 又一次不得不重新打开Windows "cmd“窗口,因为我更改了这些环境变量.

好像以前效果更好。注意,它在下面做的并不多。它还在失败。或者它不需要它们,因为它是在前一次运行时发现的。

代码语言:javascript
复制
C:\Windows\system32>cd %ANT_HOME%

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml -Ddest=system
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib

probe-m2:

download-m2:

dont-validate-m2-checksum:

validate-m2-checksum:

checksum-mismatch:

checksum-match:

get-m2:

macros:

init:

logging:

junit:

xml:

networking:

regexp:

antlr:

bcel:

jdepend:

bsf:

debugging:

jruby:

beanshell:

rhino:

script:

javamail:

jspc:
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)

jai:

nonm2-macros:

init-no-m2:

init-cache:

-setup-temp-cache:

-fetch-netrexx:
      [ftp] getting files

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:325: The following error occurred whil
e executing this line:
C:\source_code\apache-ant-1.8.3\fetch.xml:144: java.net.SocketException: Permiss
ion denied: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
        at org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStr
eam.java:114)
        at org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream
.java:535)
        at java.lang.Thread.run(Thread.java:722)

Total time: 4 seconds
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-05-07 04:59:32

Apache在显示实际堆栈跟踪方面做得不太好。因此,要解决Ant问题,也可以用Java进行调试。在我的示例中,我能够通过运行这段代码来排除故障。您需要将"sqljdbc_auth.dll“放置到run目录中,才能使其工作。这假设您已经允许i2b2用户的权限。

代码语言:javascript
复制
import java.sql.*;

public class TestConnection
{
    public static void main(String[] args)
    {
        DB db = new DB();
        db.dbConnect("jdbc:sqlserver://LAPTOP-INSPIRON\\SQLEXPRESS:1435;databaseName=i2b2_demo;integratedSecurity=true;","i2b2","i2b2");
    }
}

class DB
{
    public DB() {}

    public void dbConnect(String db_connect_string, String db_userid, String db_password)
    {
        try
        {
            Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password);
            System.out.println("connected");
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
};

构建本体数据库所必需的i2b2步骤:

(1)所有程序> Server 2008 R2 Express >配置工具> Server配置管理器>右键单击instance /IP协议>选择Enable

(2) SSCM - TCP/IP属性> IP地址(选项卡)> set IP2 (节)> IP地址到本地IP地址(例如,192.168.1.101)

(3) SSCM - TCP/IP属性> IP地址(选项卡)> IPAll (节)>删除动态端口。

(4) SSCM - TCP/IP属性> IP地址(选项卡)> IPAll (节)>添加静态端口1435 (缺省值为1433,但其中有两个实例)。

(5) JDBC -如果连接到Server 2008,则不要为JDBC使用apache ant jar文件。相反,下载JDBC版本4并使用"sqljdbc.jar“,然后在build.xml类路径jar列表中使用它。

(6) JDBC -在这些文件夹中放置"sqljdbc_auth.dll“(在ant目录中):

代码语言:javascript
复制
C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\{folder}\

(7) JDBC -如果您从另一台计算机连接到此SQL框,请创建防火墙传入规则以允许端口(1433、1434或1435 .或者任何你选择的) TCP。

(8) JDBC连接字符串

代码语言:javascript
复制
db.url=jdbc:sqlserver://LAPTOP-INSPIRON\\SQLEXPRESS:1435;databaseName=i2b2_demo;

(9) Apache下载--如果选择使用二进制文件,则不需要调用"build“。在这种情况下,跳过10-12。如果您选择下载src文件,您将在运行"build“之前执行3项操作,否则它会说”生成失败“而不是”生成成功“。

(10)“构建安装”-从build.xml中的lite列表中删除了test-jar (原名为"data_build.xml")

代码语言:javascript
复制
  <target name="dist-lite"
    depends="jars,test-jar"

to

  <target name="dist-lite"
    depends="jars"

(11)“构建安装”--在"lib“文件夹下添加一个名为”可选“的文件夹

(12)“建造安装”-以下是答案:

Workaround for Apache Ant Install Bug

(13)获取进程-运行"ant -f fetch.xml -Ddest=system“

(14) Ant命令-运行以下"ant _workdata_tables_Release1-6“。换句话说,不要使用-f。如果不想将"data_build.xml“重命名为"build.xml”,请使用-buildfile (而不是-f)参数和构建文件的路径和文件名。

(15)按照正确的顺序执行命令,以便正确地构建数据库。如果你不这么做,就重新开始。

FYI:如果我们使用Red和Red数据比较工具,这会容易得多。

票数 1
EN

Stack Overflow用户

发布于 2012-05-06 09:45:08

看起来Ant根本没有安装在您的计算机上。所以我认为你必须下载并安装它:

http://ant.apache.org/

http://ant.apache.org/manual/index.html

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10469543

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档