add external libraries jar to jmeter-maven-plugin - maven

Hello I'm using this https://github.com/jmeter-maven-plugin/jmeter-maven-plugin currently which the sample project works fine with a simple jmeter test.
However, I was wondering how does jars get added to the /lib folder.
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.174</version>
I need the above dependencies for my testplan in which my preprocessors uses certain imports from within it.
In JMeter its just drag and drop all jars related into the folder.
I tried adding the top code into the pom file to no avail since after running it the log file says unable to resolve import. There seem to be plugins documentation but I thought dependencies labelled on the pom files gets built with any JMeter tests.
Any help or clarification is appreciated.

See Adding jar's to the /lib directory
add any additional Java libraries to JMeter's lib/ directory by using the <testPlanLibraries> configuration element
<configuration>
<testPlanLibraries>
<artifact>org.apache.activemq:activemq-spring:5.15.2</artifact>
In your case
<artifact>com.amazonaws:aws-java-sdk-s3:1.12.174</artifact>

Related

ConversionException in running a Jmeter jmx file with Ultimate thread group in Intellij maven

Facing the below issue in running Ultimate thread group jmx in intellij maven (please note, for normal thread group jmx file, there is no issue. And in pom file also the required dependencies are added, which i believe is the ctg(custom thread group) one) . I am getting this error for that jmx execution alone -
missing class Conversion Exception:
required-type-ListedHashTree
converter-type-ScriptWrapperConverter
What needs to be changed now to make it executable in intellij . I am using mvn commands to trigger the jmx
I think you need to add the following dependency to your project classpath:
jmeter-plugins-casutg
Something like:
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-casutg</artifactId>
<version>2.10</version>
</dependency>
You may find Five Ways To Launch a JMeter Test without Using the JMeter GUI article and jmeter-from-code repository for some examples.
I had found the solution to this. Apart from adding it to the dependency,
You need to add this also to the jmeter extensions in the pom.xml
<jmeterExtensions>
<artifact>kg.apc:jmeter-plugins-casutg:2.8</artifact>
</jmeterExtensions>
My script started running after this change in pom.xml

The jar file provided by Maven repository does not include class files

I need to use BaseDetectorTest provided from one of Spotbugs extension library
I added the maven dependency from (FindBugs Test Utility)
But it does not include the BaseDetectorTest class file (Once Maven is updated, the jar file is added to the external libraries - but not the class file).
I am wondering why it happens.
My guess is "the Jar file provided by the repository is still being developed"
Could you teach me how to fix it?
find-sec-bugs/findsecbugs-test-util/src/test/java/com/h3xstream/findbugs/test/BaseDetectorTest.java is a test class. .../src/test/... and ...Test.java are indicators for that. Test classes aren't included in a project's JAR (by the jar:jar goal of the Maven JAR Plugin which is the default binding for the package phase) but in a project's ...-tests.jar which is created by the jar:test-jar goal.
On MvnRepository select a version tag, e.g. 1.9.0, then Files jar (2 KB) View All to find the ...-tests.jar. Use it with:
<dependency>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findbugs-test-util</artifactId>
<version>1.9.0</version>
<classifier>tests</classifier>
</dependency>
On Maven Central you can get a later version (1.11.0), select it and then Browse 📁 to find it. Use it with:
<dependency>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-test-util</artifactId>
<version>1.11.0</version>
<classifier>tests</classifier>
</dependency>

Alfresco SK3 - JAR AIO Project dependencies

In the < SDK3 AMP projects, there was the ability to install-amps in the POM.xml when running from Eclipse. This would allow for an existing AMP(s) project to be applied when running/debugging from Eclipse.
As we are changing our projects to JAR AllInOne projects, I'm wondering what the actual process is to duplicate this? "Project2" fails to run (mvn clean install alfresco:run) as our "Project2" JARs are dependent on models in the "Project1" Jars.
I thought the overlays section might do this but the model defined in "Project1" is not found when running "Project2" via maven.
Previously when using the AMPs the install-AMPs section of the pom.xml would make sure that the dependencies webscripts/models were available at runtime. Is there a way to mimic this with two AIO Jar projects?
AIO projects with Alfresco SDK 3.0 can pull in other AMPs without a problem.
Make sure that you've uncommented the part of the pom.xml that actually builds an AMP. Look for the section that starts like this:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>build-amp-file</id>
And make sure it is uncommented.
Once you've done that, you can add AMPs as both platform-tier dependencies and Share-tier dependencies. For a platform-tier dependency, look for the "" element and add your dependencies there, making sure to specify that the type is "amp".
For a Share-tier dependency look for "".
For example, I often like to install the JavaScript Console in my AIO projects because it is so handy. So, I add the following to platformModules:
<!-- JavaScript Console -->
<moduleDependency>
<groupId>de.fmaul</groupId>
<artifactId>javascript-console-repo</artifactId>
<type>amp</type>
<version>0.7-SNAPSHOT</version>
</moduleDependency>
And I add the following to :
<!-- JavaScript Console -->
<moduleDependency>
<groupId>de.fmaul</groupId>
<artifactId>javascript-console-share</artifactId>
<type>amp</type>
<version>0.7-SNAPSHOT</version>
</moduleDependency>
With those in place, when I run my AIO project using run.sh, Tomcat starts up, the JavaScript Console AMPs are installed, and my customizations are installed.

FlinkMLTools NoClassDef when running jar built with maven

I'm working on a recommender system using Apache Flink. The implementation is running when I test it in IntelliJ, but I would like now to go on a cluster. I also built a jar file and tested it locally to see if all was working but I encountered a problem.
java.lang.NoClassDefFoundError: org/apache/flink/ml/common/FlinkMLTools$
As we can see, the class FlinkMLTools used in my code isn't found during the running of the jar.
I built this jar with Maven 3.3.3 with mvn clean install and I'm using the version 0.9.0 of Flink.
First Trail
The fact is that my global project contains other projects (and this recommender is one of the sub-project). In that way, I have to launch the mvn clean install in the folder of the right project, otherwise Maven always builds a jar of an other project (and I don't understand why). So I'm wondering if there could be a way to say explicitly to maven to build one specific project of the global project. Indeed, perhaps the path to FlinkMLTools is contained in a link present in the pom.xml file of the global project.
Any other ideas?
The problem is that Flink's binary distribution does not contain the libraries (flink-ml, gelly, etc.). This means that you either have to ship the library jar files with your job jar or that you have to copy them manually to your cluster. I strongly recommend the first option.
Building a fat-jar to include library jars
The easiest way to build a fat jar which does not contain unnecessary jars is to use Flink's quickstart archetype to set up the project's pom.
mvn archetype:generate -DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-scala -DarchetypeVersion=0.9.0
will create the structure for a Flink project using the Scala API. The generated pom file will have the following dependencies.
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-scala</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-scala</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients</artifactId>
<version>0.9.0</version>
</dependency>
</dependencies>
You can remove flink-streaming-scala and instead you insert the following dependency tag in order to include Flink's machine learning library.
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-ml</artifactId>
<version>0.9.0</version>
</dependency>
When you know build the job jar with mvn package, the generated jar should contain the flink-ml jar and all of its transitive dependencies.
Copying the library jars manually to the cluster
Flink includes all jars which are located in the <FLINK_ROOT_DIR>/lib folder in the classpath of the executed jobs. Thus, in order to use Flink's machine learning library you have to put the flink-ml jar and all needed transitive dependencies into the /lib folder. This is rather tricky, since you have to figure out which transitive dependencies are actually needed by your algorithm and, consequently, you will often end up copying all transitive dependencies.
How to build a specific sub-module with maven
In order to build a specific sub-module X from your parent project you can use the following command:
mvn clean package -pl X -am
-pl allows you to specify which sub-modules you want to build and -am tells maven to also build other required sub-modules. It is also described here.
In cluster mode, Flink does not put all library JAR files into the classpath of its workers. When executing the program locally in IntelliJ all required dependencies are in the classpath, but not when executing on a cluster.
You have two options:
copy the FlinkML Jar file into the lib folder of all Flink TaskManager
Build a fat Jar file for you application that includes the FLinkML dependencies.
See the Cluster Execution Documentation for details.

include yajsw in maven build

My project uses YAJSW wrapper. When i build project, i simple copy jars, required by YAJSW into assembly. So YAJSW's jars simple commited into my svn. I don't like this because my project hold 25 MB of space and 20 MB of that is YAJSW's libs.
I want to try:
delete unnecessary YAJSW's libs, but i don't know which of them are required.
download required libs from repo during build. But how to make it easy without listing all YAJSW jars in dependencies?
It will be best if there is a YAJSW pom with dependencies, but i don't find that. Maybe someone create that, so i can upload it to my repo?
This is most fundamental things you need to copy in your assembly cycle:
<fileSet>
<directory>
your_yajsw_folder
</directory>
<outputDirectory>/yajsw</outputDirectory>
<includes>
<include>bat/</include>
<include>conf/</include>
<include>lib/</include>
<include>scripts/</include>
<include>wrapper.jar</include>
<include>wrapperApp.jar</include>
</includes>
</fileSet>
Right now I'm trying to add the wrapper.jar and wrapperApp.jar from maven, hence removing it from the assymbly file. However for that I might need to edit the scripts to look for the jar in the lib folder instead of the wrapper_home
I found the maven dependencies:
<dependency>
<groupId>org.rzo.yajsw</groupId>
<artifactId>wrapper</artifactId>
<version>11.11</version>
</dependency>
<dependency>
<groupId>org.rzo.yajsw</groupId>
<artifactId>wrapperApp</artifactId>
<version>11.11</version>
</dependency>
Indeed, I have done this - please check out my project at:
https://github.com/griels/yajsw-maven-mk2
I think there are some other projects that have performed such an integration, e.g.
https://github.com/neo4j-attic/yajsw
But I couldn't find much info on them.
Alternatively, if you can find some way to run the YAJSW Gradle build scripts from Maven, you might be able to use that. I had to track down most of the dependencies by hand.

Resources