question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding own dependency

See original GitHub issue

Hey,

I’m trying to add a dependency with maven.

My dependencies in the pom.xml looks like this:

<dependencies>
        <dependency>
            <groupId>org.lambadaframework</groupId>
            <artifactId>runtime</artifactId>
            <version>${lambada.version}</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-lambda-java-log4j</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-lambda-java-events</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

It’s the dependency json.org that won’t work.

The Error I receive is :

 A required class was missing while executing org.lambadaframework:lambada-maven-plugin:0.0.6:deploy: org/json/JSONObject
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[project>se.some.project:project-test:0.0.6, parent: ClassRealm[maven.api, parent: null]]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.json.JSONObject

I did suspect that it’s the maven-shade-pluginthat causes the problem but the log clearly states that it’s included in the shaded jar:

Including org.json:json:jar:20160810 in the shaded jar.

Local maven set up

Maven home: /opt/apache-maven-3.3.9
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12", arch: "x86_64", family: "mac"

Is it possible to add dependencies?

Thanks!

//Jonathan

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:29 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
cagataygurturkcommented, Sep 22, 2016

No, of course it won’t crash with other dependencies. This is obviously a JSON library specific error, I’ll investigate the root cause. With other dependencies you should not experience any issue in theory.

0reactions
arranubelscommented, Oct 3, 2016

I have tested the above, it works. Also I made the lambada maven plugin dependency the project itself, that also worked. Doing that you don’t need to duplicate all your dependencies.

            <plugin>
                <groupId>org.lambadaframework</groupId>
                <artifactId>lambada-maven-plugin</artifactId>
                <version>${lambada.version}</version>
                <configuration>
                    <packageName>${deployment.package}</packageName>
                    <regionToDeploy>${deployment.region}</regionToDeploy>
                    <stageToDeploy>${deployment.stage}</stageToDeploy>
                    <lambdaMaximumExecutionTime>${deployment.maximumExecutionTime}</lambdaMaximumExecutionTime>
                    <lambdaMemorySize>${deployment.lambdaMemorySize}</lambdaMemorySize>
                </configuration>
        <dependencies>
        <dependency>
            <groupId>org.lambadaframework</groupId>
            <artifactId>boilerplate</artifactId>
            <version>0.0.6</version>
        </dependency>
        </dependencies>

See: https://github.com/arranubels/lambadaframework-boilerplate/blob/example1.2/pom.xml

We should probably add this to the boiler plate. I’ll send a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add build dependencies - Android Developers
To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file....
Read more >
Declaring dependencies - Gradle User Manual
Many Gradle plugins add pre-defined configurations to your project. ... A custom configuration is useful for separating the scope of dependencies needed for ......
Read more >
How to create your own dependency injection framework in Java
This article will guide you to understand and build a lightweight Java application using your own Dependency Injection implementation.
Read more >
How to add a custom <<Usage>> dependency and ... - IBM
By creating and adding a custom <<Usage>> dependency in a profile, you can easily share it across project teams. Answer. Following techniques ...
Read more >
Create your Own Maven Dependency - YouTube
This tutorial shows how to create your own Maven project as dependency for other Maven projects.Please subscribe if you like my tutorial ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found