Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Eclipse not picking up maven Managed Dependencies(Eclipse not picking up maven Managed Dependencies)
Eclipse not picking up maven Managed Dependencies [message #941237] Fri, 12 October 2012 06:20 Go to next message
David Weber is currently offline David Weber
Messages: 1
Registered: October 2012
Location: Zurich
Junior Member
I'm trying to create an application with Scout that is built with maven.
Therefore, I first followed the tutorial to create the minicrm (http://wiki.eclipse.org/Scout/Tutorial/3.8/Minicrm/Minicrm_Step-by-Step) and then I followed the Maven Tycho Build tutorial (http://wiki.eclipse.org/Scout/Tutorial/3.8/Maven_Tycho_Build).
At the moment I have the minicrm application that works fine when I start it in eclipse and the maven build is working as well.

I am using:
- Eclipse Juno Service Release 1 (Eclipse for Scout Developers, RCP Version 4.2.1.M20120914-1800, Scout Version 3.8.1.201209171521)
- Maven Integration for Eclipse (Version 1.2.020120903-1050)
- Tycho Project Configurators (Version 0.6.0.201207302152)
- Apache Maven 3.0.4
- Java 1.7.0_04
- Windows 7, Version 6.1, Arch: Amd64

Now I want to add additional maven dependencies to my minicrm.server pom.xml.
E.g. log4j dependency for logging:
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
		</dependency>


Unfortunately, the dependencies that I add are not recognized by eclipse.
I would expect them to appear in a "Maven dependency" project tree node similar to "Plug-in Dependencies" but the project does not contain such a node.
When I try to add for example the log4j Logger in the StandardOutlineService the class is not recognized.

import org.apache.log4j.Logger;
...
private Logger logger = Logger.getLogger(this.getClass().getName());


I already tried a "Maven - Update Project..." from the context menu. Could there be a problem between the m2eclipse Plugin and the plugin created with Scout or did I forget something? I would at least expect that the maven build still works but when I add the Logger and its import statement and run a "mvn clean install" the build fails as well.

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.15.0:co
mpile (default-compile) on project org.eclipse.minicrm.server: Compilation failu
re: Compilation failure:
[ERROR] C:\local\eclipse\workspace_scout2\org.eclipse.minicrm.server\src\org\ecl
ipse\minicrm\server\services\outline\StandardOutlineService.java:[11,0]
[ERROR] import org.apache.log4j.Logger;
[ERROR] ^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.log4j cannot be resolved
[ERROR] C:\local\eclipse\workspace_scout2\org.eclipse.minicrm.server\src\org\ecl
ipse\minicrm\server\services\outline\StandardOutlineService.java:[16,0]
[ERROR] private Logger logger = Logger.getLogger(this.getClass().getName());
[ERROR] ^^^^^^
[ERROR] Logger cannot be resolved to a type
[ERROR] C:\local\eclipse\workspace_scout2\org.eclipse.minicrm.server\src\org\ecl
ipse\minicrm\server\services\outline\StandardOutlineService.java:[16,0]
[ERROR] private Logger logger = Logger.getLogger(this.getClass().getName());
[ERROR] ^^^^^^
[ERROR] Logger cannot be resolved


I just found one similar post in the Newcomers forum (http://www.eclipse.org/forums/index.php/m/793812/?srch=new+maven+dependency#msg_793812) but there was no answer.

The pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project
	xsi:schemaLocation=...
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.eclipse.minicrm</groupId>
		<artifactId>org.eclipse.minicrm</artifactId>
		<version>1.0.0-SNAPSHOT</version>
		<relativePath>../org.eclipse.minicrm/</relativePath>
	</parent>

	<artifactId>org.eclipse.minicrm.server</artifactId>
	<packaging>eclipse-plugin</packaging>

	<dependencies>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
		</dependency>
	</dependencies>

</project>


The .project file:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>org.eclipse.minicrm.server</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.ManifestBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.SchemaBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
		<nature>org.eclipse.scout.sdk.ScoutNature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.pde.PluginNature</nature>
	</natures>
</projectDescription>








[Updated on: Fri, 12 October 2012 06:22]

Report message to a moderator

Re: Eclipse not picking up maven Managed Dependencies [message #942307 is a reply to message #941237] Sat, 13 October 2012 07:30 Go to previous message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 117
Registered: November 2010
Senior Member
This is a theoretical answer (from what I am reading on the eclipse planet and in other forums). I did not try to build a scout application with maven (yet). So if my answer bring nothing, feel free to ignore it (and to inform others).

From what I understood eclipse plugins project and maven bring different solutions to handle dependency on other library. A typical Eclipse project will use manifest to declare dependency on a library (and product or feature to request the library). A typical maven project will do this in a POM file.

People describe these two options as:
- Manifest first approach
- Pom first approach


Because Scout comes from the Eclipse world, I think it uses the Manifest first approach. I am not sure what "Maven - Update Project..." is doing, but I do not think that it is updating the manifest file.

My first guess would have a look at the manifest file using the "plugin manifest editor" (open META-INF/MANIFEST.MF or plugin.xml in the server plugin). Check the dependencies tab. When we use log4j, we have an entry in "required plug-in".



Independent from Eclipse Scout, I imagine that every Eclipse project is confronted to this problem. Maybe if a good "pom first approach" pattern emerged in the Eclipse world, the SDK should provide an option to create a new Eclipse Scout project that use this pattern.

Previous Topic:Cancellation of parallel queries on server
Next Topic:PageBox
Goto Forum:
  


Current Time: Wed Apr 23 19:57:40 EDT 2014

Powered by FUDForum. Page generated in 0.02250 seconds