Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Maven build throwing at runtime 'NoSuchMethodError' while the class exists in the JAR


    boomslap
     Share

    Recommended Posts

    Long story short I'm trying to build a script with maven because I want to use dependencies. 

    Currently I only have one dependency and that's the Apache Commons Lang3. I know from the guide that you have to pack the dependencies in the script JAR which I have setup successfully since when I open the jar I can see the class files of the dependency in there.

    For some reason though, when in the script I execute a method from the dependency I get the 'NoSuchMethodError'

    Can anyone think of why that possibly happens? Let me know if you need any additional information.

    I am using Eclipse IDE

    ERROR:

    Quote

    2:53:34 PM: [ERROR] The script had a problem starting:
        java.lang.NoSuchMethodError: 'java.lang.String org.apache.commons.lang3.StringUtils.capitalize(java.lang.String)'
        at adeline.Adeline.onStart(Adeline.java:34)
        at org.dreambot.api.script.AbstractScript.run(AbstractScript.java)
        at java.base/java.lang.Thread.run(Thread.java:833)

    My POM:

    Spoiler
    <project xmlns="http://maven.apache.org/POM/4.0.0"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    
    	<groupId>boomslap</groupId>
    	<artifactId>RsBot_Adeline</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<name>Dreambot Adeline</name>
    	<description>Noice</description>
    
    	<properties>
    		<!-- java properties -->
    		<maven.compiler.target>1.8</maven.compiler.target>
    		<maven.compiler.source>1.8</maven.compiler.source>
    		<dreambot.path>C:/Users/boomslap/DreamBot</dreambot.path>
    	</properties>
    
    	<dependencies>
    		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    		<dependency>
    			<groupId>org.apache.commons</groupId>
    			<artifactId>commons-lang3</artifactId>
    			<version>3.12.0</version>
    		</dependency>
    
    		<dependency>
    			<groupId>dreambot</groupId>
    			<artifactId>client</artifactId>
    			<version>1.0</version>
    			<scope>system</scope>
    			<systemPath>${dreambot.path}/BotData/client.jar</systemPath>
    		</dependency>
    
    	</dependencies>
    
    
    	<!-- build jar file with dependencies -->
    	<build>
    	<plugins>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.1.1</version>
    
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <outputDirectory>${dreambot.path}/Scripts</outputDirectory>
                    </configuration>
    
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
    
                </plugin>
            </plugins>
    	</build>
    
    </project>

     

    Thanks for your attention!

    Edited by boomslap
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.