jenkins pipeline import org.apache.poi - excel

I am trying to automate with excel and can't import the org.apache.poi for use.
I try something like this:
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
pipeline {
agent any
stages {
stage('excel') {
steps {
script {
SXSSFWorkbook wb = new SXSSFWorkbook(100);
}
}
}
}
}
and get "unable to resolve class org.apache.poi.ss.usermodel.Row" with all of them.
In the script part the error is the same: "unable to resolve class SXSSFWorkbook".
If I download the jar file from search.maven.org where do I put it to be used?

If you are running on Tomcat you can add them to <TOMCAT_HOME>/lib directory. Else you can add them to your JDK itself, into $JAVA_HOME/jre/lib/ext/

Related

Pusher-js is not working with chrome extension V3 migration - window is undifined

We are using pusher-js in our chrome extension application to connect with backend messaging.
Till manifest V2, It worked perfectly fine. But post manifest V3 migration, pusher-js is throwing Uncaught ReferenceError: window is not defined while doing load-unpacked.
I event tried updating the pusher-js npm package, but dint worked.
I am well know that window object is not available in new manifest V3. But how to make pusher-js work in my chrome extension.
This error happens as soon as I import the pusher from pusher-js.
Removing the pusher import, code works perfectly. Can anyone help me on this?
import code pusher
/* global chrome */
// import Config from '../config';
import StatusChecker from '../utils/status-checker';
import StatusCheckerNotifier from '../utils/status-checker-notifier';
import loggingService from '../utils/logging-service';
import fetchProvider from '../fetch';
import fetchGraphqlProvider from '../fetch-graphql';
import { addLinkedInCsrfTokenHeader } from './csrf-token-header';
import LoggingService from './services/LoggingService';
import FetchableService from './services/FetchableService';
import ContractChooserResolver from './services/ContractChooserResolver';
import dispatcher from '../dispatcher';
import ContextRuntime from '../contextruntime';
import { pusherInit } from './pusher-init';
import { SIDEBAR_EVENTS } from '../constants';
import * as Utils from './helpers';
class GoldmineBackend {
init(userMeta) {
console.log('testing');
}
}
export default new GoldmineBackend();
service-worker console error
service-worker console error - source
build load-unpacked error

Kotlin - menuInflater cannot find reference of the xml file

I am trying to add create option menu to my activity, however the android-studio sent me this error
Unresolved reference: chat_app_menu
Here is my code in Kotlin
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.chat_app_menu)
return true
}
The line with menuInflater.inflate(R.menu.chat_app_menu) show me the error Unresolved reference: chat_app_menu
However, I have been create the resource file chat_app_menu.xml under res\menu\
Here are my import files
package com.example.chat_app
import android.R
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuInflater
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.auth.FirebaseAuth
My file directory:
What should I do to disable this error to make the app work?
Use your com.example.chat_app.R instead of android.R
import com.example.chat_app.R

groovy.lang.MissingPropertyException: No such property:

I am trying to get my head around groovy scripting to make some changes to a jenkins pipeline and I keep getting this error:
groovy.lang.MissingPropertyException: No such property: credentials for class:
I have tried declaring the variable with def but I still get the exception, eclipse does not recognise that the property exists.
What am I doing wrong?!
#!/usr/bin/groovy
package common.pipeline
import common.pipeline.Credentials
Credentials credentials = new Credentials()
def withCredentials(steps) {
credentials.productionPipeline(steps)
}
This script will be compiled by groovy into a Script class with the field definition inside the run method, and with another method withCredentials that is trying to access the field (kinda like this):
import common.pipeline.Credentials
class Script1 extends Script {
def withCredentials(steps) {
credentials.productionPipeline(steps)
}
def run(args) {
Credentials credentials = new Credentials()
}
}
As you can see, this won't work, as the credentials aren't at Field level in the class...
Groovy has an annotation to make this happen:
#!/usr/bin/groovy
package common.pipeline
import common.pipeline.Credentials
import groovy.transform.Field
#Field Credentials credentials = new Credentials()
def withCredentials(steps) {
credentials.productionPipeline(steps)
}

getting error in "pretty" in cucumber file

Getting below error while running the test runner file,can someone please suggest how to resolve this after changing the different version of the report, still facing the same error
cucumber.runtime.CucumberException: Only one formatter can use STDOUT, now both pretty and pretty use it. If you use more than one formatter you must specify output path with PLUGIN:PATH_OR_URL
at cucumber.runtime.formatter.PluginFactory.defaultOutOrFailIfAlreadyUsed(PluginFactory.java:185)
at cucumber.runtime.formatter.PluginFactory.convertOrNull(PluginFactory.java:144)
at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:99)
at cucumber.runtime.formatter.PluginFactory.create(PluginFactory.java:87)
at cucumber.runtime.RuntimeOptions.getPlugins(RuntimeOptions.java:245)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:291)
at com.sun.proxy.$Proxy14.done(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.done(JUnitReporter.java:227)
at cucumber.api.junit.Cucumber.run(Cucumber.java:101)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Test Runner File:-
package com.ntrs.msf.runner;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import com.ntrs.msf.managers.FileReaderManager;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
//#RunWith(CucumberWithSerenity.class)
#RunWith(Cucumber.class)
#CucumberOptions(tags = {"#IRR515-Test",}, features = "src/test/resources/features/", plugin = { "pretty",
"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" }, glue = {
"com/ntrs/msf/stepDefinitions" }, monochrome = false)
public class Holdings515_Test {
#AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));
}
}
Try changing plugin = to format =
Does that help?

ALL time groovy compilation error

All time am getting below error message in groovy...
Could not understand whats causing this " Unexpected token error" ????
I used to think only PERL give bad compilation error,now groovy outperforming it..
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
D:\Playground\groovy\release-b-work\cmd_line_soapui\trial.groovy: 12:
unexpected token: myrunner # line 12, column 1.
myrunner.setProjectFile("D:\soapui-release-B\try.xml");
^
1 error
Code taken from comment;
import com.eviware.soapui.SoapUIProTestCaseRunner;
import com.eviware.soapui.support.*;
import com.eviware.soapui.model.*;
import com.eviware.soapui.impl.wsdl.*;
import com.eviware.soapui.*;
class trial {
def myrunner = new com.eviware.soapui.SoapUIProTestCaseRunner();
myrunner.setProjectFile("D:\soapui-release-B\try.xml");
myrunner.setTestSuite("MediaAssetServiceTestSuite");
myrunner.setTestCase("createMediaAsset TestCase");
myrunner.run();
}
You need to put your code in a method
You can't just add code into a class at class level
Try:
import com.eviware.soapui.SoapUIProTestCaseRunner;
import com.eviware.soapui.support.*;
import com.eviware.soapui.model.*;
import com.eviware.soapui.impl.wsdl.*;
import com.eviware.soapui.*;
class trial {
def someMethod() {
def myrunner = new com.eviware.soapui.SoapUIProTestCaseRunner();
myrunner.setProjectFile("D:\soapui-release-B\try.xml");
myrunner.setTestSuite("MediaAssetServiceTestSuite");
myrunner.setTestCase("createMediaAsset TestCase");
myrunner.run();
}
}

Resources