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

...

Info

Internally at Magnolia we would have liked to switch to Eclipse Indigo a long time ago but then preferred to stick to Helios due to the shortcomings caused by this still unresolved Indigo bug (see also related issue http://jira.magnolia-cms.com/browse/BUILD-72Image Removed). However, if for some reason you have to use Indigo, we found some workarounds you can read below.

  • 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. 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 Removed

Choose to resolve the issue later and import the project.

Now, in the Eclipse Markers view you should get the following Maven error preventing the project from building (you should also receive some negligible warnings about m2e ignoring some plugin's goals):

Warning

Plugin execution not covered by lifecycle configuration: info.magnolia:maven-setproperty-plugin:1.1.1:set-property (execution: currentDate, phase: generate-resources)

To get rid of the error and proceed with project build you'll need to add the following snippet to the pluginManagement/plugins section of your project's pom.xml

...

<plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
  <lifecycleMappingMetadata>
    <pluginExecutions>
      <pluginExecution>
        <pluginExecutionFilter>
          <groupId>info.magnolia</groupId>
          <artifactId>maven-setproperty-plugin</artifactId>
          <versionRange>[1.1.1,)</versionRange>
          <goals>
            <goal>set-property</goal>
          </goals>
        </pluginExecutionFilter>
        <action>
          <execute></execute>
        </action>
      </pluginExecution>
    </pluginExecutions>
  </lifecycleMappingMetadata>
</configuration>
</plugin>

Kepler (3.9)

As of July 9th 2013 Kepler based image is available on file server with same set of plugins as those installed for 3.7 with addition of

  • JBoss Tools (for editing BPMN workflow definitions)
  • Vaadin plugin
  • JRebel plugin

After installing this bundle

  • reconfigure location of checkstyle header files according to Checkstyle for Eclipse (In difference to the page i would recommend to just checkout magnolia-build-tools directly from svn and point header properties for ce and ee checkstyle configurations directly to those files).
  • it might be also necessary to click "Apply" again on formatting configuration to get it being used by eclipse (pbly related to workspace config?). See more details at Eclipse setup
  • I had some performance issues with Indigo and git reindexing which was the primary reason for making Kepler bundle. Those issues were not solved by installing Kepler but only by trashing the workspace and recreating it again ... do the same if in doubt.
  • If you have any problems with Kepler bundle, please report them along w/ solution or workaround here.

Complete list of installed plugins:

Image Added

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, an Eclipse Team provider for the Git version control system. For any question concerning Eclipse and Git integration, please read the EGit User guide.
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.

For some background info and the ratio behind this new behaviour in m2e, please read:

http://wiki.eclipse.org/M2E_plugin_execution_not_covered

http://dev.eclipse.org/mhonarc/lists/m2e-users/thrd7.html starting at http://dev.eclipse.org/mhonarc/lists/m2e-users/msg00448.html

  • magnolia-empty-webapp configuration

The new version of Maven integration For WTP plugin, will create a /target/m2e-wtp folder and serve project resources from there. This may cause issues when choosing to serve modules without publishing them in the Servers configuration. To solve this,

  • go to project Properties -> Deployment Assembly
  • remove the m2e-wtp folder
  • add src/main/webapp folder and src/main/resources folders 

Your configuration should now look similar to that of the screenshot below.
Image Removed

Notice that when importing new modules which magnolia-empty-webapp depends on, the Deployment Assembly configuration will be automatically updated. In the example above, the magnolia-ui-admincentral module was imported after the magnolia-empty-webapp and is now directly served from the eclipse workspace instead of the local Maven repository jar.

Eclipse Helios (3.6)

Info

As of 4th April 2012 our SVN repository will be gradually migrated to GIT. The new Eclipse bundle is a general update of the previous Helios-based bundle which now also contains EGit plugin, an Eclipse Team provider for the Git version control system.
To know more about Git usage you can start by reading our wiki page

If you can access Magnolia's internal network, a preinstalled eclipse for Mac OS X(Cocoa 64) called eclipse-helios-macosx-cocoa-64-egit.zip can be found at our file server under Product Development/Eclipse

There is also preinstalled eclipse for Linux-64b called eclipse-helios-linux-64bit.zip. It can also be found in Product Development/Eclipse folder. This version supports Git DVCS.

The eclipse-helios-macosx-cocoa-64-egit.zip bundle was created on 3 April 2012 and consists of the following platform, plugins and related versions:

Image Removed

Cloning a Git repo with EGit

Info

Before proceeding please read our Git Usage wiki page

  • Copy the URL for Git repo (i.e. ssh://git@git.magnolia-cms.com/testing.git)
  • Open the Git Repository Exploring perspective > right click on the left pane and choose Paste Repository Path or URI

Image Removed

  • A dialog like the one below should pop up. Make sure to use the user git to connect

Image Removed
(In case you have a passphrase set on your private key, you'll have to enter this in a next step)

Install Eclipse (3.5)

Download the Java EE edition which includes WTP (web tool project).

Subversive (Subversion Plugin)

Install the plugin

  1. Help / Install New Software ..
  2. select: Galileo - http://download.eclipse.org/releases/galileo
  3. select: Collaboration/Subversive SVN Team Provider

Note: to get the latest stable version you will better use the project's url. I had to do that because eclipse started to block on startups otherwise.

Note: There seems to be a version conflict with Subversive.  If you look at the table showing the content of the eclipse-helios-macosx-cocoa-64.zip bundle (in a preceding section, above) you will notice that it includes Subclipse, not Subversive.  If you have problems with Subversive you might try Subclipse instead.  http://subclipse.tigris.org/update_1.6.x

Connectors
You also have to install a connector. Subversive will prompt you on the first usage.

  1. open "SVN Repository" perspective (Window -> Open perspective)
  2. select SVNKit 1.3
  3. proceed installation

Git (EGit Plugin)

Install the plugin

  1. Help / Install New Software ..
  2. Add... (to add a new site)
  3. http://download.eclipse.org/egit/updates
  4. select: Eclipse Git Team Provider/Eclipse EGit

Open the Git perspective

  1. Window -> Open perspective -> Other...
  2. select: Git Repository Exploring

Known problems

  • EGit is not accepting your ssh passphrase when pulling or pushing. (Related Bug Report).
    EGit doesn't use system-wide ssh, but JSch instead. It's a Java implementation of SSH2.
    Problem is, that JSch does not support private keys until ver. 0.1.44.

To install latest JSch to your eclipse press:

  1. Help / Install New Software
  2. Add... (to add a new site)
  3. http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository/
  4. select: All Orbit Bundles / JSch
  • If still don't work, check out Preferences / General / Network Connections / SSH2 and verify, if it's using correct private key.

Maven integration (M2Eclipse)

Plugin

  1. Help -> Install New Software ..
  2. Add... (to add a new site)
  3. http://m2eclipse.sonatype.org/sites/m2e

WTP Integration

  1. Help -> Install New Software ..
  2. Add... (to add a new site)
  3. http://m2eclipse.sonatype.org/sites/m2e-extras
  4. select: Maven Integration for WTP

Subversive Integration

  1. Help -> Install New Software ..
  2. Add... (to add a new site)
  3. http://www.polarion.org/projects/subversive/download/integrations/update-site/
  4. select: Subversive Integration for M2Eclipse

FreeMarker IDE (optional)

Register the following URLs in Help / Software Updates

  1. http://download.jboss.org/jbosstools/updates/JBossTools-3.0.3.GA
  2. select: FreeMarker IDE

Any Edit (optional)

Used for tab to space transformations and other cleanup on save

  1. http://andrei.gmxhome.de/eclipse
  2. select: AnyEditTools

JIRA integration (optional)

...

Maven Repository

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

...

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>
    
  2. Copy the files to webapp/WEB-INF.

B) Put minimal JARs into WEB-INF/lib

  1. In the webappfolder, execute:

    Code Block
    none
    none
      mvn war:inplace
    

    This generates a complete webapp in your src/webapp directory as opposed to target/webapp-name-1.0-SNAPSHOT. This is an Eclipse specific workaround.

  2. Delete all JARs except the taglib JARs in src/main/webapp/WEB-INF/lib
  3. Minimize the taglib JAR

    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/*
    

...

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:make sense:

Code Block
xml
xml
<value key="mgnl" object-class="info.magnolia.module.templating.MagnoliaTemplatingUtilities"/>
<value key="ctx" object-class="info.magnolia.context.MgnlContext"/>
Code Block
xmlxml
<value key="mgnlstk" object-class="info.magnolia.module.templatingkit.templatingutil.MagnoliaTemplatingUtilitiesSTKUtil"/>
<value key="ctxstate" 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).

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)

...

[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].
.magnolia.cms.core.AggregationState"/>

Configure Code Style

If you are an internal developer or a contributor please follow the instructions found here: Development Standards and Guidelines.

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
[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].

The expected stacktrace on startup is:

Code Block
none
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 

The expected stacktrace on startup is:

Code Block
nonenone
SEVERE: Exception sending context initialized event to listener instance of class info.magnolia.cms.servlets.MgnlServletContextListener
java.lang.NullPointerExceptioncontextInitialized(MgnlServletContextListener.java:176)
	at infoorg.magnoliaapache.cmscatalina.beanscore.configStandardContext.PropertiesInitializer.loadAllModulePropertieslistenerStart(PropertiesInitializerStandardContext.java:923843)
	at infoorg.magnoliaapache.cmscatalina.beanscore.configStandardContext.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)

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:

...

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-enforcer-plugin</artifactId>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>

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:

...

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)
start(StandardContext.java:4350)

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
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-enforcer-plugin</artifactId>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>

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
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)

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
<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>

Solution 2: make the servlet-api dependency scope providedSolution: exclude the servlet api jar. Verify that you don't have the servlet api jar in your maven dependencies.

Example:

Code Block
xml
xml
<dependency>
	<groupId>info.magnolia<   <groupId>javax.servlet</groupId>
	<artifactId>magnolia-empty-webapp<   <artifactId>servlet-api</artifactId>
	<version>4.0.1</version>
	<type>pom</type>
	<exclusions>
		<exclusion>
		        <groupId>javax.servlet</groupId>
		        <artifactId>servlet-api</artifactId>
		</exclusion>
	</exclusions>   <version>2.5</version>
   <scope>provided</scope>
</dependency>

Solution 3: make the gwt-user dependency scope provided.

Example:

Code Block
xml
xml
<dependency>
   <groupId>com.google.gwt</groupId>
   <artifactId>gwt-user</artifactId>
   <version>2.4.0</version>
   <scope>provided</scope>
</dependency>

Webapp project doesn't work

...

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