2015-01-10 4 views
0

기본적으로 oracle 데이터베이스 연결을 생성하고 반환하는 build.gradle의 메소드가 있습니다. 그러나 스크립트를 실행하는 동안 아래 스크린 샷과 같이 빌드가 실패한 것으로 표시됩니다. build.gradle의 메소드 반환 유형

enter image description here

def ext.getOracleConnection = { -> 
      java.sql.Connection conn = null; 
      try{ 
       configurations.jdbcdriver.files.each { 
        groovy.sql.Sql.classLoader.addURL(it.toURI().toURL()) 
       } 
       configurations.xdb.files.each { 
        groovy.sql.Sql.classLoader.addURL(it.toURI().toURL()) 
       } 
       //load the jdbc driver and create the connection. 
       java.sql.DriverManager.registerDriver(groovy.sql.Sql.classLoader.loadClass("oracle.jdbc.OracleDriver").newInstance()) 
       readProperites(); 
       conn = java.sql.DriverManager.getConnection(db_url, dbUser, dbPassword); 

      } 
      catch(Exception e){ 
       e.printStackTrace(); 
      } 
      return conn; 
     } 

나는 java.sql.Connection에 복귀 유형을 변경 시도했지만 작동하지 않습니다. 누구든지 해결책을 제안 할 수 있습니까?

+2

'def'를 제거하십시오. –

+1

다음에 스크린 샷 대신 예외 텍스트를 추가하십시오. 귀하의 스크린 샷을 검색 할 수 없습니다 (시간이이 치유됩니다) – cfrick

답변

2

이것은 오류 메시지와 같이 컴파일 오류입니다.

선언문에서 def을 제거해야합니다.