Blair Robertson (via Magnolia Forums)
2014-10-10 18:23:40 UTC
I was just following the steps in the tutorial found below and came into a 2 maven problems so far and thought I would share my fixes.
Tutorial:
http://academy.magnolia-cms.com/display/MA/U2+Starting+a+CE+project+with+Maven
I am running JDK 1.7 and aiming for Magnolia 5.3, I have maven 2.2.1 running alongside maven 3.2.3
[code]
$ mvn2 --version
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.7.0_67
Java home: C:\Program Files\Java\jdk1.7.0_67\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 8.1" version: "6.3" arch: "amd64" Family: "windows"
[/code]
First problem occurred when I was attempting to run [code]mvn war:inplace[/code] and I was getting this result:
[code]
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure
line number : 1
-------------------------------
[/code]
This turns out to be because the archetype is putting java 1.6 into the pom.xml files instead of 1.7 which I am using.
Fixed by changing to 1.7 here in the project pom and the module pom:
[code]
<properties>
<magnoliaVersion>5.3</magnoliaVersion>
<javaVersion>1.7</javaVersion>
</properties>
[/code]
And by adding the maven-war-plugin version 2.1.1 to the project pom:
[code]
....
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
...
[/code]
After these changes the [code]mvn war:inplace[/code] was successful, but both maven and Eclipse were still complaining about a couple of libraries from Vaadin & JSoup:
[code]
[WARNING] POM for 'com.vaadin:vaadin-shared:pom:7.1.7:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'com.vaadin:vaadin-theme-compiler:pom:7.1.7:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'org.jsoup:jsoup:pom:1.6.3:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[/code]
Looking in the Maven repo for these files and the problem appeared to be one of the ma:
[code]
***@BROBERTSON-LAP ~/brobertson/.m2/repository
$ cat ./org/jsoup/jsoup/1.6.3/jsoup-1.6.3.jar
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
[/code]
Looking back through the shell history I see it picked these POMs up from a strange repository, and that repo is returning the 301 (rather than a 404 I guess):
[code]
[INFO] Unable to find resource 'com.vaadin:vaadin-shared:pom:7.1.7' in repository vaadin-addons (https://maven.vaadin.com/vaadin-addons)
Downloading: http://oss.sonatype.org/content/repositories/vaadin-releases//com/vaadin/vaadin-shared/7.1.7/vaadin-shared-7.1.7.pom
178b downloaded (vaadin-shared-7.1.7.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://oss.sonatype.org/content/repositories/vaadin-releases//com/vaadin/vaadin-shared/7.1.7/vaadin-shared-7.1.7.pom
178b downloaded (vaadin-shared-7.1.7.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - IGNORING
[WARNING] POM for 'com.vaadin:vaadin-shared:pom:7.1.7:compile' is invalid.
[/code]
A change to settings.xml that was created as part of [i]Initializing the environment[/i] in http://documentation.magnolia-cms.com/display/DOCS/Maven to add the default maven repos fixed this. My current full file is this:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- This is a settings.xml file retrieved from https://nexus.magnolia-cms.com -->
<profiles>
<profile>
<id>magnolia-repositories</id>
<repositories>
<repository>
<id>magnolia.nexus.public</id>
<url>https://nexus.magnolia-cms.com/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>fallback1</id>
<name>Fallback</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>fallback2</id>
<name>Fallback 2</name>
<url>http://repo2.maven.org/maven2/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>magnolia.nexus.public</id>
<url>https://nexus.magnolia-cms.com/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>magnolia-repositories</activeProfile>
</activeProfiles>
<pluginGroups>
<!-- define the sonatype plugin group, so the nexus plugins will work without typing the groupId -->
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>
</settings>
[/code]
HTH
Tutorial:
http://academy.magnolia-cms.com/display/MA/U2+Starting+a+CE+project+with+Maven
I am running JDK 1.7 and aiming for Magnolia 5.3, I have maven 2.2.1 running alongside maven 3.2.3
[code]
$ mvn2 --version
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.7.0_67
Java home: C:\Program Files\Java\jdk1.7.0_67\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 8.1" version: "6.3" arch: "amd64" Family: "windows"
[/code]
First problem occurred when I was attempting to run [code]mvn war:inplace[/code] and I was getting this result:
[code]
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure
line number : 1
-------------------------------
[/code]
This turns out to be because the archetype is putting java 1.6 into the pom.xml files instead of 1.7 which I am using.
Fixed by changing to 1.7 here in the project pom and the module pom:
[code]
<properties>
<magnoliaVersion>5.3</magnoliaVersion>
<javaVersion>1.7</javaVersion>
</properties>
[/code]
And by adding the maven-war-plugin version 2.1.1 to the project pom:
[code]
....
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
...
[/code]
After these changes the [code]mvn war:inplace[/code] was successful, but both maven and Eclipse were still complaining about a couple of libraries from Vaadin & JSoup:
[code]
[WARNING] POM for 'com.vaadin:vaadin-shared:pom:7.1.7:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'com.vaadin:vaadin-theme-compiler:pom:7.1.7:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'org.jsoup:jsoup:pom:1.6.3:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[/code]
Looking in the Maven repo for these files and the problem appeared to be one of the ma:
[code]
***@BROBERTSON-LAP ~/brobertson/.m2/repository
$ cat ./org/jsoup/jsoup/1.6.3/jsoup-1.6.3.jar
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
[/code]
Looking back through the shell history I see it picked these POMs up from a strange repository, and that repo is returning the 301 (rather than a 404 I guess):
[code]
[INFO] Unable to find resource 'com.vaadin:vaadin-shared:pom:7.1.7' in repository vaadin-addons (https://maven.vaadin.com/vaadin-addons)
Downloading: http://oss.sonatype.org/content/repositories/vaadin-releases//com/vaadin/vaadin-shared/7.1.7/vaadin-shared-7.1.7.pom
178b downloaded (vaadin-shared-7.1.7.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://oss.sonatype.org/content/repositories/vaadin-releases//com/vaadin/vaadin-shared/7.1.7/vaadin-shared-7.1.7.pom
178b downloaded (vaadin-shared-7.1.7.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - IGNORING
[WARNING] POM for 'com.vaadin:vaadin-shared:pom:7.1.7:compile' is invalid.
[/code]
A change to settings.xml that was created as part of [i]Initializing the environment[/i] in http://documentation.magnolia-cms.com/display/DOCS/Maven to add the default maven repos fixed this. My current full file is this:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- This is a settings.xml file retrieved from https://nexus.magnolia-cms.com -->
<profiles>
<profile>
<id>magnolia-repositories</id>
<repositories>
<repository>
<id>magnolia.nexus.public</id>
<url>https://nexus.magnolia-cms.com/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>fallback1</id>
<name>Fallback</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>fallback2</id>
<name>Fallback 2</name>
<url>http://repo2.maven.org/maven2/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>magnolia.nexus.public</id>
<url>https://nexus.magnolia-cms.com/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>magnolia-repositories</activeProfile>
</activeProfiles>
<pluginGroups>
<!-- define the sonatype plugin group, so the nexus plugins will work without typing the groupId -->
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>
</settings>
[/code]
HTH
--
Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=11aeb4d2-545c-49f4-9521-716e30a3644e
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <user-list-***@magnolia-cms.com>
----------------------------------------------------------------
Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=11aeb4d2-545c-49f4-9521-716e30a3644e
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <user-list-***@magnolia-cms.com>
----------------------------------------------------------------