Paul Murray
Paul Murray

Reputation: 1012

How to access external libraries using Play Framework?

I'm trying to use an external library contained in a .jar file with the Play Framework.

I've added the .jar file to the lib/ directory, to no avail.

I know I could add the dependency to my project/Build.scala file, but I have no idea what the group ID, artifact ID, or version numbers are. Are those found in the .jar file?

Upvotes: 1

Views: 2244

Answers (3)

Khanh Quach
Khanh Quach

Reputation: 11

You can go to Project Structure Under Project Setting -> Modules -> Go to tab Dependencies , under sbt-unmanaged-jars you can edit and add your lib manually.

Upvotes: 1

skh
skh

Reputation: 1

How to use IntelliJ with Play Framework and Scala see this short tutorial.

but you have to add all necessary jars to lib folder before call create module command idea with-sources=yes

So, again

  1. Create a new application
  2. Create lib folder and copy all jars
  3. Create the IDE module

This is only one way how I can deploy it successfully

Upvotes: 0

esycat
esycat

Reputation: 1364

groupID, artifactID and version are “Maven Coordinates”. These three identifies are needed to find exact jar file in the Maven Repository. When provided, the build system (and Play! uses SBT) can automatically find, download and include the library you want to use (assuming that that library exists in the repository).

As that is a global repository, groupID should uniquely identify the project. groupID is usually the same as the main project's package, e.g. org.apache.commons. artifactID is supposed to identify a particular jar in the project, e.g. commons-io. version, quite obviously, points to the exact version of the jar.

Upvotes: 0

Related Questions