Reputation: 5133
I have a Gradle project in IntelliJ.
I added this dependency to Maven dependencies list
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
When I try to compile my code using gradlew build
I receive this compilation error:
gradlew build
:compileJava
....java:5: error: package org.imgscalr does not exist
import org.imgscalr.Scalr;
^
....java:52: error: cannot find symbol
BufferedImage thumbnail = Scalr.resize(image, 150);
^
symbol: variable Scalr
location: class PlaceController
2 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
What is happening?
After adding the dependency inside maven file, IntelliJ automatically downloads the file and imports it where it is needed. By doing this, the error from the IDE, that says tahat Scalr could not be found, dissapears.
Upvotes: 0
Views: 6553
Reputation: 106390
You should be covering this in your build.gradle
file instead. Here's an example of how it would look.
repositories {
mavenCentral()
}
dependencies {
compile 'org.imgscalr:imgscalr-lib:4.2'
}
If you were looking to do a wholesale conversion from Maven to Gradle, you'd have to convert your POMs over first and iron out any bugs that may have resulted due to the conversion.
Upvotes: 1