문제

그래서 ant 빌드 파일 에이 대상이 있습니다.

<target name="migrate" description="Migrate the database">
    <exec executable="${basedir}/vendor/bin/doctrine-module" failonerror="true">
        <arg line="migrations:migrate"/>
    </exec>
</target>
.

Doctrine 마이그레이션 명령은 실행되기 전에 질문을하고 예 또는 아니오 답변을 기대합니다.그래서 내 빌드가 실패합니다 :

richard@richard-desktop:~/projects/myproject$ ant migrate
Buildfile: /home/richard/projects/myproject/build.xml

migrate:
     [exec]                                                            
     [exec]                     Doctrine Migrations                    
     [exec]                                                            
     [exec] 
     [exec] 
     [exec] 
     [exec]                       
     [exec]   [RuntimeException]  
     [exec]   Aborted             
     [exec]                       
     [exec] 
     [exec] 
     [exec] migrations:migrate [--write-sql] [--dry-run] [--configuration[="..."]] [--db-configuration[="..."]] [version]
     [exec] 
     [exec] 
     [exec] WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)

BUILD FAILED
/home/richard/projects/myproject/build.xml:42: exec returned: 1

Total time: 0 seconds
richard@richard-desktop:~/projects/myproject$ 
.

어떻게 ant를 해당 질문에 자동으로 대답하도록 어떻게 대답 할 수 있습니까?

도움이 되었습니까?

해결책

실제로 매우 쉽습니다 :

<target name="migrate" description="Migrate the database">
    <exec executable="${basedir}/vendor/bin/doctrine-module" failonerror="true">
        <arg line="migrations:migrate --no-interaction"/>
    </exec>
</target>
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top