借助一下软件版广大的人气,请问板上前辈们
小弟有Maven专案资料夹结构如下:
Project
├src/main/java
│ └ com.abc.xyz
│ └Auth.java
└src/main/resources
└certs
└credential.p12
Auth.java里有段程式码用来验证:
=====================================================================
File file = new File(classLoader.getResource("cert.p12").getFile());
String filePath = file.getAbsolutePath();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(Collections.singleton(
CalendarScopes.CALENDAR_READONLY))
.setServiceAccountPrivateKeyFromP12File(new File(filePath))
.setServiceAccountUser(SERVICE_ACCOUNT_USER)
.build();
=====================================================================
将该专案档的jar部署到Server上后
会出现找不到credential档案的错误讯息
想请问credential档案应该放在专案或server哪里才能被找到?
又该怎么指定路径呢?