I am trying to create a new tool for other components. The tool is for initializing firebase. Here is the file structure.
but the problem is I am unable to import the package, I am getting this error:
startup failed: sparts_Notification_initialize_Firebase: 11: Unexpected input: 'import' @ line 11, column 17. import com.pythys.firebase.FirebaseClient ^ 1 error
here is the tool code:
package com.pythys.firebase
import com.google.auth.oauth2.GoogleCredentials
import com.google.firebase.FirebaseApp
import com.google.firebase.FirebaseOptions
import com.google.firebase.messaging.FirebaseMessaging
import com.google.firebase.messaging.Message
import com.google.firebase.messaging.Notification
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import groovy.transform.CompileStatic
@CompileStatic
public class FirebaseClient {
private static final Logger logger = LoggerFactory.getLogger(FirebaseClient.class)
public FirebaseClient(String keyFile) {
def credentials = GoogleCredentials.fromStream(new FileInputStream(keyFile))
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(credentials)
.build()
FirebaseApp.initializeApp(options)
}
}
here is how I am trying to import:
<service verb="initialize" noun="Firebase">
<actions>
<script><![CDATA[
import com.pythys.firebase.FirebaseClient
..........
I am not sure If I am missing anything.