Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Table of Contents

Install Eclipse & Plugins

Eclipse Indigo

...

(3.7)

{
Info
}

As

of

4th

April

2012

*

our

SVN

repository

will

be

gradually

migrated

to

GIT

*

.

The

new

Eclipse

bundle

is

based

on

latest

(as

of

April

2012)

Indigo

and

also

contains

[

EGit

plugin

|http://www.eclipse.org/egit/]

,

an

Eclipse

Team

provider

for

the

Git

version

control

system.

For

any

question

concerning

Eclipse

and

Git

integration,

please

read

the

[

EGit

User

guide

|http://wiki.eclipse.org/EGit/User_Guide]. To know more about Git usage you can start by [reading our wiki page|http://wiki.magnolia-cms.com/display/DEV/Git+usage] {info} {note}-There's a [bug in Indigo|https://bugs.eclipse.org/bugs/show_bug.cgi?id=350414] (see also related issue [http://jira.magnolia-cms.com/browse/BUILD-72]) which causes Eclipse to show an annoying error message on poms. Worry not, however, your IDE will work fine nonetheless. Read more below.- {note}If you can access Magnolia's internal network, a preinstalled eclipse for *Mac OS X(Cocoa 64)* called _

.
To know more about Git usage you can start by reading our wiki page

Note

There's a bug in Indigo (see also related issue http://jira.magnolia-cms.com/browse/BUILD-72) which causes Eclipse to show an annoying error message on poms. Worry not, however, your IDE will work fine nonetheless. Read more below.

If you can access Magnolia's internal network, a preinstalled eclipse for Mac OS X(Cocoa 64) called eclipse-indigo-macosx-cocoa-64-egit.zip

...

can

...

be

...

found

...

at

...

our

...

file

...

server

...

under

...

Product

...

Development/Eclipse

...

There

...

is

...

also

...

preinstalled

...

eclipse

...

for

...

Linux-64b

...

.

...

It

...

can

...

also

...

be

...

found

...

in

...

Product

...

Development/Eclipse

...

folder.

...

This

...

version

...

supports

...

Git

...

DVCS.

...

The

...

eclipse-indigo-macosx-cocoa-64-egit.zip

...

bundle

...

was

...

created

...

on

...

10

...

April

...

2012

...

and

...

consists

...

of

...

the

...

following

...

platform,

...

plugins

...

and

...

related

...

versions:

Image Added

  • Autoshare

By default cloning a Git repo and then importing it as a Java or Maven project does not show it as "shared", meaning that the Eclipse project looks disconnected from your local Git repo. If you're used to work with SVN you might find this baffling, as you're accostumed to checkout a project from the central scm repository and see it connected to it, so that changes to your local copy are visually decorated by a special label or icon. In order to save you some clicks to achieve the same with Git you need to check the following option under Eclipse -> Preferences -> Team -> Git -> Projects

Image Added

  • m2e 1.0 known issue

Indigo introduces m2e (Maven 2 Eclipse) 1.0, which seems to cause some problems with plugins that are not "known" by m2e. This hits Magnolia with the setproperty Maven plugin and other Maven plugins as well (See list below). If you have m2e 1.0 installed you will likely get the following error upon importing a Maven project (i.e. a Magnolia module) into Eclipse: 

Warning

No marketplace entries found to handle Execution currentDate, in /pom.xml in Eclipse.  Please see Help for more information.

Image Added

Just choose to resolve the issue later and import the project.

  • Table of plugins which currently do not have a m2e connector

groupId

artifactId

version

goal

execution

phase

org.apache.maven.plugins

maven-javadoc-plugin

2.8

javadoc

default

generate-resources

info.magnolia

maven-setproperty-plugin

1.1.1

set-property

currentDate

generate-resources

org.codehaus.mojo

gwt-maven-plugin

2.4.0

resources

default

process-resources

(Last update April 2012)

  • Other handy plugins

The following plugins might come in handy. These are not part of the Indigo bundle for now.

Maven Repository

See Maven setup. Be sure to follow these steps first as else you'll not be able to checkout magnolia properly!

Add SVN Repository

You will have to register our SVN repository in case you want to checkout magnolia modules/projects

  1. open SVN Repository Exploring Perspective
    Image Added
  2. add repository location
    Image Added
  3. http://svn.magnolia-cms.com/svn

...


  1. Image Added

Create/Checkout

...

a

...

Project

...

New

...

Checkout

Image Added

  1. open "SVN Repository" perspective (Window -> Open perspective)
  2. select module/project to check out
  3. click "Check out as Maven project..."

...

  1. in

...

  1. the

...

  1. context

...

  1. menu

...

Importing

...

an

...

already

...

checked

...

out

...

project

...

from

...

file

...

system

...

Sometimes

...

it

...

is

...

more

...

convenient

...

to

...

checkout

...

a

...

project

...

manually

...

and

...

then

...

use

...

the

...

eclipse

...

import

...

function.

...

This

...

is

...

especially

...

helpful

...

if

...

the

...

module

...

to

...

be

...

imported

...

has

...

submodules.

...

  1. File

...

  1. ->

...

  1. Import

...

  1. in

...

  1. the

...

  1. import

...

  1. dialog

...

  1. select

...

  1. 'Maven

...

  1. Projects'

...

Setup

...

the

...

Server

...

(Tomcat)

...

Create

...

a

...

Server

...

If

...

not yet done create a server.

Image Added

Deploy the Webapp project

Image Added

Open Server Edit Pane

Doubleclick on the server item

Image Added

Server settings: Disable publishing

Make sure that the option Serve modules without publishing is selected. This ensures that the classes are taken from the target directories. 

Image Added

Server settings: Increase timeouts

In these same settings, increase both timeout values by a factor of 10.

Freemarker specific settings

Taglib definitions (tld)

FreeMarker does not search the classpath to find taglib definition. It uses only WEB-INF/lib and the entries defined in web.xml directly. There are two workarounds:

A) Register taglib definitions in web.xml

  1. Edit web.xml and add the taglib definitions as follows. It is important to add them before jsp-property-group.
    Code Block
    xml
    xml
    <jsp-config>
       <taglib>
         <taglib-uri>cms-taglib</taglib-uri>
         <taglib-location>cms-taglib.tld</taglib-location>
       </taglib>
       <taglib>
         <taglib-uri>cms-util-taglib</taglib-uri>
         <taglib-location>cms-util-taglib.tld</taglib-location>
       </taglib>
       <taglib>
          <taglib-uri>cmsfn-taglib</taglib-uri>
          <taglib-location>cmsfn-taglib.tld</taglib-location>
        </taglib>
    
        <jsp-property-group>
          <url-pattern>*.jsp</url-pattern>
          <page-encoding>UTF-8</page-encoding>
        </jsp-property-group>
    </jsp-config>
    

...

  1. Copy the files to webapp/WEB-INF

...

  1. .

...

B)

...

Put

...

minimal

...

JARs

...

into

...

WEB-INF/lib

...

  1. In the webapp folder, execute:
    Code Block
    none
    none
      mvn war:inplace
    

...

  1. This

...

  1. generates

...

  1. a

...

  1. complete

...

  1. webapp

...

  1. in

...

  1. your

...

  1. src/webapp

...

  1. directory

...

  1. as

...

  1. opposed

...

  1. to

...

  1. target/webapp-name-1.0-SNAPSHOT

...

  1. .

...

  1. This

...

  1. is

...

  1. an

...

  1. Eclipse

...

  1. specific

...

  1. workaround.

...

  1. Delete

...

  1. all

...

  1. JARs

...

  1. except

...

  1. the

...

  1. taglib

...

  1. JARs

...

  1. in

...

  1. src/main/webapp/WEB-INF/lib

...

  1. Minimize

...

  1. the

...

  1. taglib

...

  1. JAR

...

  1. Code Block
    none
    none
     zip -d magnolia-taglib-cms-4.1.1-SNAPSHOT.jar /info/*
     zip -d magnolia-taglib-utility-4.1.1-SNAPSHOT.jar /info/*
    

...

Auto completion

Freemarker templates do not provide automatically auto completion of the provided objects.

The provided objects like ctx, stk or mgnl must be declared to the IDE, that they can be auto completed.

There for a configuration file must be provided in each project in your workspace. The file is named '.freemarker-ide.xml'.

...

I

...

have

...

attached

...

it

...

to

...

this

...

page

...

without

...

the

...

dot

...

at

...

the

...

beginning,

...

or

...

I

...

can't

...

upload

...

it

...

on

...

the

...

Mac

...

otherwise

...

(hidden).

...

The

...

important

...

part

...

of

...

this

...

configuration

...

file

...

is

...

the

...

declaration

...

of

...

the

...

objects

...

the

...

auto

...

completion

...

should

...

know.

...

I

...

think

...

these

...

four

...

declarations

...

I

...

use

...

make

...

sense:

Code Block
xml
xml


{code:xml}<value key="mgnl" object-class="info.magnolia.module.templating.MagnoliaTemplatingUtilities"/>
<value key="ctx" object-class="info.magnolia.context.MgnlContext"/>
<value key="stk" object-class="info.magnolia.module.templatingkit.util.STKUtil"/>
<value key="state" object-class="info.magnolia.cms.core.AggregationState"/>

Configure Code Style

If you are an internal developer or a contributor please follow the instructions found here: Coding Conventions.

Tips and Tricks

Get the sources or a linked jar / module

  • select the jar (in the Maven Dependencies library)
  • right click -> Maven -> Download Sources

Dependencies

The dependencies are resolved inside the workspace. This is quite helpful. But this will only work if the version you reference in the project and the version of the module you checked out has the same version. In some cases you will have to adapt the pom files locally (to point to the current snapshot for instance).

Use company wide Java Code Style & Compiler preferences

Simply import the preferences file into your Eclipse.

Known Problems

Wrong maven version is used for dependency checks

If the project can't build because of the following message (printed in Maven Console)

Code Block
none
none
{code}
h1. Configure Code Style

If you are an internal developer or a contributor please follow the instructions found here: [Coding Conventions].

h1. Tips and Tricks

h3. Get the sources or a linked jar / module

* select the jar (in the Maven Dependencies library)
* right click \-> Maven \-> Download Sources

h3. Dependencies

The dependencies are resolved inside the workspace. This is quite helpful. But this will only work if the version you reference in the project and the version of the module you checked out has the same version. In some cases you will have to adapt the pom files locally (to point to the current snapshot for instance).

h3. Use company wide Java Code Style & Compiler preferences

Simply import the [preferences file|^mgnl_eclipse_indigo_config.epf]  into your Eclipse.

h1. Known Problems

h2. Wrong maven version is used for dependency checks

If the project can't build because of the following message (printed in Maven Console)
{code:none}[WARN] Rule 0: org.apache.maven.plugin.enforcer.RequireMavenVersion failed with message: Detected Maven Version: 2.1-SNAPSHOT is not in the allowed range [2.0.9,2.0.9].
{code}

The

...

expected

...

stacktrace

...

on

...

startup

...

is:

Code Block
none
none

{code:none}SEVERE: Exception sending context initialized event to listener instance of class info.magnolia.cms.servlets.MgnlServletContextListener
java.lang.NullPointerException
	at info.magnolia.cms.beans.config.PropertiesInitializer.loadAllModuleProperties(PropertiesInitializer.java:92)
	at info.magnolia.cms.beans.config.PropertiesInitializer.loadAllProperties(PropertiesInitializer.java:79)
	at info.magnolia.cms.servlets.MgnlServletContextListener.contextInitialized(MgnlServletContextListener.java:176)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
{code}

You

...

can

...

either

...

add

...

the

...

following

...

to

...

the

...

pluginManagement

...

section

...

in

...

your

...

main

...

project

...

pom

...

to

...

disable

...

the

...

enforcer

...

plugin

...

or

...

select

...

the

...

eclipse

...

profile

...

:

Code Block
xml
xml

{code:xml}<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-enforcer-plugin</artifactId>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>
{code}

Then

...

clean

...

all

...

projects

...

To

...

ensure

...

that

...

everything

...

is

...

fine

...

you

...

have

...

to

...

check

...

that

...

magnolia-core/target/classes/mgnl-bean.properties

...

exists.

...

Freemarker

...

can't

...

find

...

tags

...

(tlds)

...

See

...

#Freemarkerspecificsettings

Project contains duplicate entry

Sometimes the same jar is references twice (by maven and EAR dependencies). This sometimes happens if you open eclipse freshly. To make the project compile again you must remove the ear dependency:

  • right click project -> Java EE -> Update EAR libraries

Class Cast Exception: info.magnolia.cms.filters.MgnlMainFilter

...

Symptom:

Code Block
none
none


{code:none}SEVERE: Exception starting filter magnoliaFilterChain
java.lang.ClassCastException: info.magnolia.cms.filters.MgnlMainFilter
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:255)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
{code}

This

...

typically

...

depends

...

on

...

the

...

servlet-api

...

AND/OR

...

the

...

gwt-user

...

dependencies

...

in

...

your

...

pom.xml(s)

...

and

...

Tomcat

...

(i.e.

...

never

...

seen

...

this

...

problem

...

with

...

jetty).

...

The

...

solutions

...

provided

...

below

...

are

...

not

...

mutually

...

exclusive

...

and

...

you

...

might

...

need

...

to

...

apply

...

a

...

combination

...

or

...

all

...

of

...

them.

...

Solution

...

1:

...

exclude

...

the

...

servlet

...

api

...

jar.

...

Verify

...

that

...

you

...

don't

...

have

...

the

...

servlet

...

api

...

jar

...

in

...

your

...

maven

...

dependencies.

...

Example:

Code Block
xml
xml

{code:xml}<dependency>
	<groupId>info.magnolia</groupId>
	<artifactId>magnolia-empty-webapp</artifactId>
	<version>4.0.1</version>
	<type>pom</type>
	<exclusions>
		<exclusion>
		        <groupId>javax.servlet</groupId>
		        <artifactId>servlet-api</artifactId>
		</exclusion>
	</exclusions>
</dependency>
{code}

Solution

...

2:

...

make

...

the

...

servlet-api

...

dependency

...

scope

...

provided

...

.

...

Example:

Code Block
xml
xml

{code:xml}
<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>servlet-api</artifactId>
   <version>2.5</version>
   <scope>provided</scope>
</dependency>
{code}

Solution 3: make the 
</dependency>

Solution 3: make the gwt-user

...

dependency

...

scope

...

provided

...

.

...

Example:

Code Block
xml
xml

{code:xml}
<dependency>
   <groupId>com.google.gwt</groupId>
   <artifactId>gwt-user</artifactId>
   <version>2.4.0</version>
   <scope>provided</scope>
</dependency>
{code}
h2. Webapp project 

Webapp project doesn't

...

work

...

  1. make

...

  1. sure

...

  1. that

...

  1. you

...

  1. have

...

  1. only

...

  1. one

...

  1. webapp

...

  1. project

...

  1. open

...

  1. add

...

  1. the

...

  1. pom

...

  1. dependency

...

  1. (not

...

  1. only

...

  1. the

...

  1. war

...

  1. dependency)

...

  1. otherwise

...

  1. the

...

  1. dependencies

...

  1. defined

...

  1. in

...

  1. the

...

  1. referenced

...

  1. war

...

  1. file

...

  1. won't

...

  1. be

...

  1. seen

...

  1. use

...

  1. mvn

...

  1. war:inplace

...

  1. to

...

  1. overlay

...

  1. the

...

  1. webapp

...

  1. project

...

  1. (make

...

  1. sure

...

  1. that

...

  1. the

...

  1. WEB-INF/web.xml

...

  1. exists

...

  1. ensure

...

  1. that

...

  1. you

...

  1. delete

...

  1. WEB-INF/lib

...

  1. after

...

  1. a

...

  1. war:inplace

...

  1. check

...

  1. settings

...

  1. project/project

...

  1. facets/dynamic

...

  1. web

...

  1. module

...

  1. ==>

...

  1. 2.4

...

  1. works

...

  1. (helios,

...

  1. wtp

...

  1. 2.4),

...

  1. 3.0

...

  1. doesn't

...

  1. (helios,

...

  1. wtp

...

  1. 3

...

  1. .0)

NPE when configuring tomcat with "don't

...

publish"

...

option

...

  1. delete

...

  1. Servers,

...

  1. delete

...

  1. .project

...

  1. and

...

  1. .settings

...

  1. from

...

  1. the

...

  1. webapp

...

  1. and

...

  1. reimport

...

  1. the

...

  1. webapp

...

webapp

...

is

...

not

...

recognized

...

as

...

webapp

...

and

...

doesn't

...

show

...

in

...

tomcat

...

when

...

trying

...

to

...

add

...

it

...

  1. go

...

  1. to

...

  1. project/project

...

  1. facets

...

  1. and

...

  1. make

...

  1. sure dynamic

...

  1. web

...

  1. module

...

  1. and

...

  1. java

...

  1. and

...

  1. javascript

...

  1. facets

...

  1. are

...

  1. checked.

...

  1. rebuild

...

  1. the

...

  1. project

...

modules

...

are

...

not

...

installed

...

when

...

installing

...

the

...

webapp

...

  1. cause:

...

  1. modules

...

  1. are

...

  1. not

...

  1. visible

...

  1. if

...

  1. the

...

  1. faceted

...

  1. build

...

  1. version

...

  1. of

...

  1. java

...

  1. doesn't

...

  1. match

...

  1. the

...

  1. current

...

  1. version

...

  1. or

...

  1. that

...

  1. used

...

  1. by

...

  1. the

...

  1. webapp

...

  1. project

...

  1. solution:

...

  1. update

...

  1. project

...

  1. config

...

  1. and

...

  1. change

...

  1. java

...

  1. version

...

Module

...

Dependency

...

Exception

...

Symptom:

Code Block
none
none


{code:none}ERROR info.magnolia.init.MagnoliaServletContextListener : Oops, Magnolia could not be started
info.magnolia.module.model.reader.ModuleDependencyException: Module Magnolia Mail Module (version 4.5.0-SNAPSHOT) is dependent on myCoolModule version 4.5/*, which was not found.
   at info.magnolia.module.model.reader.DependencyCheckerImpl.checkSpecificDependency(DependencyCheckerImpl.java:79)
{code}

Solution:

...

ensure

...

that

...

no

...

resource

...

is

...

excluded

...

under

...

myCoolModule

...

->

...

Build

...

path

...

->

...

Configure

...

Build

...

Path...

...

This

...

might

...

happen

...

when

...

i.e.

...

updating

...

the

...

Maven

...

dependencies

...

if

...

the

...

m2Eclipse

...

plugin

...

is

...

installed.

...

Trouble

...

shooting

...

step

...

by

...

step

...

  1. check

...

  1. if

...

  1. there

...

  1. are

...

  1. any

...

  1. build

...

  1. issues

...

  1. denoted

...

  1. in

...

  1. the

...

  1. problem

...

  1. view

...

  1. check

...

  1. if

...

  1. there

...

  1. are

...

  1. any

...

  1. problems

...

  1. denoted

...

  1. in

...

  1. the

...

  1. pom.xml

...

  1. (missing

...

  1. parents,

...

  1. ..)

...

  1. check

...

  1. if

...

  1. the

...

  1. project

...

  1. builds

...

  1. in

...

  1. the

...

  1. terminal

...

  1. (by

...

  1. using

...

  1. mvn

...

  1. only)

...

    • are

...

    • the

...

    • parent

...

    • poms

...

    • available?

...

  1. check

...

  1. the

...

  1. maven

...

  1. log

...

  1. in

...

  1. eclipse

...

  1. (select

...

  1. the

...

  1. maven

...

  1. console

...

  1. in

...

  1. the

...

  1. console

...

  1. view)

...

    • are

...

    • the

...

    • logs

...

    • fine?

...

    • verify

...

    • that

...

    • there

...

    • is

...

    • no

...

    • version

...

    • conflict

...

    • thrown

...

    • by

...

    • the

...

    • enforcer

...

    • plugin

...

      • if

...

      • so

...

      • configure

...

      • the

...

      • project

...

      • to

...

      • use

...

      • the

...

      • eclipse

...

      • profile

...

      • in

...

      • the

...

      • project

...

      • settings

...

      • (maven

...

      • tab)

...

  1. clean

...

  1. the

...

  1. project

...

    • this

...

    • ensures

...

    • that

...

    • maven

...

    • is

...

    • used

...

    • to

...

    • build

...

    • the

...

    • resources

...

    • verify

...

    • that

...

    • the

...

    • resources

...

    • have

...

    • been

...

    • built

...

    • (module

...

    • descriptor

...

    • in

...

    • target/classes/META-INF/magnolia

...

  1. update

...

  1. project

...

  1. configuration

...

    • right

...

    • click

...

    • project

...

    • ->

...

    • maven

...

    • ->

...

    • update

...

    • project

...

    • configuration

...

    • check

...

    • the

...

    • maven

...

    • console

...

    • (some

...

    • errors

...

    • are

...

    • not

...

    • reported

...

    • to

...

    • the

...

    • GUI)

...

    • one

...

    • last

...

    • step

...

    • can

...

    • be

...

    • added

...

    • to

...

    • the

...

    • above

...

    • Eclipse

...

    • voodoo

...

    • dance:

...

    • ensure

...

    • that

...

    • no

...

    • resource

...

    • is

...

    • excluded

...

    • under

...

Install

...

Sun

...

JDK

...

to

...

Ubuntu

...

By

...

default

...

Ubuntu

...

packagers

...

are

...

not

...

supporting

...

sun

...

jdk.

...

You

...

have

...

to

...

add

...

new

...

software

...

source:

{
Code Block
}
deb http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric main
{code}