2012-04-24 2 views

답변

0

예를 들어 : build.properties는 다음의 build.xml이 뜻과 같이해야 다음

<username>@[email protected]</username> 
<password value="@[email protected]"/> 

같은 값을 가질 수있는 persistence.xml을 변경할 수

속성으로
username = root 
password = shoot 

을 포함 작업.

<target name="replace"> 
    <property file="build.properties"/> 
    <replace file="persistence.xml" token="@[email protected]" value="${username}"/> 
    <replace file="persistence.xml" token="@[email protected]" value="${password}"/> 
</target> 

여기에 사용자 이름과 $ 암호 값이 자동으로 <property> 태그에서 개미에 의해 식별됩니다 $ 당신은 이름과 키 값에 액세스 할 수 있습니다.

+0

어떻게하면 persistence.xml에 build.properties 값을 삽입 할 수 있습니까? 이 링크는 persistence.xml을 표시하지 않습니다. 값을 build.xml이 실행되는 동안 build.properties에서 persistence.xml로 가져와야합니다. 즉, 값이 persistence.xml에서 자동으로 반영되어야 함을 의미합니다. – user1340856

+0

다음을 위해 Ant 태스크 값으로 바꾸기 링크를 클릭하십시오. 그렇게 해. – Phani

+0

죄송합니다 ..이 링크에서 어떤 아이디어도 얻지 못했습니다. 이건 태그가 실제로 무엇을합니까? – user1340856

0

나 자신을 상기시켜야했습니다. 그 올바른 방법은 다음과 같습니다.

일시적으로 내가했던 것처럼 사용자 이름을 하드 코딩하는 대신 build.properties 파일에서 읽을 수 있습니다. 재미있게 보내십시오.