Skip to content
Russell Keane
Main Navigation HomePosts

Appearance

Sidebar Navigation

2025

February (1)

Dynamically setting prev and next links in Vitepress

2019

November (1)

CloudFormation template failing to deploy

2018

March (1)

Subst'ing a drive in Windows 7 / 10

January (1)

Groovy - unable to resolve class

2017

October (2)

Reordering pages in LIFERAY forms

Spring / ZUUL - Failed to introspect annotated methods

June (1)

Sourcetree stuck on POST (chunked)

March (1)

Turning off Windows 10 ads

2016

December (1)

Failure to install / update ruby gems

July (2)

PostgreSQL - Casting integer to interval

piggly trace- invalid multibyte escape

June (1)

Jenkins stuck on "Retrieving Git references..."

March (1)

Jenkins & Groovy - accessing build parameters

2015

November (2)

Creating a Jenkins slave as a Windows service

Why Jenkins?

On this page

The Problem ​

I have a groovy script that I'm writing and I'm trying to [link to | include | reference] another groovy "library" that I've [written | downloaded].

I import the "library" at the top of my script:

shell
    import com.mycompany.SomeGroovyLib

But, when trying to run my script, it fails with an error:

shell
    W:\path_to_file\script.groovy: 9: unable to resolve class com.mycompany.SomeGroovyLib
     @ line 9, column 1.
       import com.mycompany.SomeGroovyLib
       ^

error

I'm using IntelliJ IDEA 2017.2.6 on Windows with groovy 2.4.6 but the same happens on earlier versions.

The solution ​

This is a simple one.

From the "File" menu [1], choose the "Project Structure..." menu item [2]:

project_structure

Then, from the "Project Structure" dialog, choose the "Modules" item in the left pane [1], then the "Dependencies" tab [2]. Now choose the + symbol on the right hand side of the dialog [3] and choose the "1 JARs or directories..." option [4].

choose_dir

Now, navigate to the path of your groovy library such that the path of your import statement ...:

import

...can be found immediately within the folder you select:

folder_choose

Finally, you will be prompted to choose what type of thing you're linking to and you should select "Classes":

choose_classes

Now you can "ok" your way back through the 2 dialogs and your project should build.

😃

Pager
Previous pageReordering pages in LIFERAY forms
Next pageSubst'ing a drive in Windows 7 / 10

All views expressed are my own

Copyright © 2015-present Russell Keane