0

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.

5
  • 3
    Sorry you are talking about a maven dependency but writing about gradle? What are really using? Commented Feb 22, 2015 at 16:01
  • The project is a gradle project and I am using gradle. But inside it, it also has a pom.xml file. Commented Feb 22, 2015 at 16:03
  • 1
    gradle doesn't use pom.xml files. It uses build.gradle files. Commented Feb 22, 2015 at 18:05
  • Then why Intellij created that pom.xml? Also why is it reacting when I make changes inside pom.xml? Commented Feb 22, 2015 at 18:52
  • @tzortzik probably because you told IntelliJ that your project was a Maven project, even though you're building it wth Gradle. Commented Feb 23, 2015 at 7:17

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.