80781

How to add Websphere Application Server Liberty Profile runtime dependencies to Maven POM?

I have a restful application that I converted to a maven project. Now, I get a compile error when using maven compile because the java-ee/openjpa packages are not found. Below is my POM file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>portal</groupId> <artifactId>portal</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>developer-portal</name> <url>http://maven.apache.org</url> <properties> <serverName>dropServer</serverName> <serverHome>C:\wlp</serverHome> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <pluginRepositories> <pluginRepository> <id>Liberty</id> <name>Liberty Repository</name> <url>http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> <dependencies> <dependency> <groupId>com.ibm.tools.target</groupId> <artifactId>was-liberty</artifactId> <version>8.5.5</version> <type>pom</type> <scope>provided</scope> </dependency> <!-- Hard-Coded, made-up dependency --> <dependency> <groupId>com.ibm.nosql</groupId> <artifactId>nosqljson</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>C:\javalib\db2_drivers\nosqljson.jar</systemPath> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>1.18</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-grizzly2</artifactId> <version>1.18</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId> <version>1.9.11</version> </dependency> <dependency> <groupId>com.sun.jersey.jersey-test-framework</groupId> <artifactId>jersey-test-framework-core</artifactId> <version>1.17.1</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>1.3.2</version> </dependency> </dependencies> <build> <finalName>developer-portal</finalName> <plugins> <plugin> <groupId>com.ibm.websphere.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>start-server</id> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> <configuration> <serverHome>${serverHome}</serverHome> <serverName>${serverName}</serverName> </configuration> </execution> </executions> </plugin> <plugin> <groupId>com.ibm.websphere.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.0</version> <configuration> <serverHome>${serverHome}</serverHome> <serverName>${serverName}</serverName> </configuration> <executions> <execution> <id>deployapp</id> <phase>pre-integration-test</phase> <goals> <goal>deploy</goal> </goals> <configuration> <appArchive>${project.build.directory}/${project.name}.war</appArchive> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>

Here is the particular error in eclipse:

Missing artifact com.ibm.tools.target:was-liberty:pom:8.5.5

And in CLI:

[ERROR] Failed to execute goal on project developer-portal: Could not resolve dependencies for project developer-porta l:developer-portal:war:0.0.1-SNAPSHOT: Failure to find com.ibm.tools.target:was-liberty:pom:8.5.5 in http://repo.maven.apache.org/ maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

References:

<ol> <li>https://www.ibm.com/developerworks/community/forums/html/topic?id=e98d726e-6f5d-470c-a042-dd8b41384235</li> <li>http://www-01.ibm.com/support/knowledgecenter/was_beta/com.ibm.websphere.wdt.doc/topics/localrepo.htm?lang=en</li> </ol>

Answer1:

The problem was maven was only looking at the central repository. To add IBM's repository, you need the following in your POM:

<repositories> <repository> <id>Liberty</id> <name>Liberty Repository</name> <url>http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url> </repository> </repositories>

Answer2:

There's two things to do: setup the IBM repository and add the appropriate dependencies to the POM. You can take a look at the links below for instructions on doing both.

Recommend

  • ImageIO throwing NPE in IIORegistry on JBoss AS 7.2.0.Final when updating to JDK 1.7 U45
  • Maven: What does the following pom.xml file gives empty jar?
  • How to discard only the last element of CKEditor undo stack?
  • Why does the address of an object change across methods?
  • Why isn't RAD (Eclipse) able to properly detect WAS server startup?
  • Bitmap of Android WebView is blank
  • How to add SSL certificate to Bluemix java cloud foundry application?
  • Using LINQ with IBM i
  • xpages partial - full search
  • disablinging autorecover option for powepoint
  • Background not visible in surface view
  • Visual Studio 2008 and JavaScript brackets formatting
  • Unable to use dot layout (graphviz as a library)
  • OnItemSelectedListener for Spinner that was added programmatically does not trigger
  • is this code truly private? (python)
  • how to automatically enter password when using ssh?
  • Deploying pre-encrypted configuration files to a production environment
  • Instanciate service on startup in Angular2
  • get passwords from chrome
  • How do i disable a text box within an iframe
  • I have two activity.I want to Send the data from second activity to previous activity.First activity
  • Custom WebViewPage inject code when razor template is rendering
  • Unable to resolve Static method?
  • Why doesn't a local variable live long enough for thread::scoped?
  • Activity overlaying. WindowManager.LayoutParams
  • Sybase Error Implicit Conversion from datatype 'VARCHAR' to 'INT' not allowed
  • Synchronize windows folders
  • How to get listview position?
  • Syntax error on tokens, AnnotationName expected instead - error on query
  • WPF version of .ScaleControl?
  • configure: error: no acceptable C compiler found in $PATH
  • Android Activity.onWindowFocusChanged doesn't get called from within TabHost
  • Eclipse CDT error: Unable to compile
  • Should I or shouldn't I use the CachingConnectionFactory with hornetq 2.4.1
  • Spray.io: When (not) to use non-blocking route handling?
  • Modifying destination and filename of gulp-svg-sprite
  • align graphs with different xlab
  • GridView Sorting works once only
  • Observable and ngFor in Angular 2
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize