1. Create a Magnolia webapp project from a template:

mvn archetype:generate -DarchetypeGroupId=info.magnolia.maven.archetypes -DarchetypeArtifactId=magnolia-project-archetype -DarchetypeVersion=RELEASE
ghost@theMachine pscu % mvn archetype:generate -DarchetypeGroupId=info.magnolia.maven.archetypes -DarchetypeArtifactId=magnolia-project-archetype -DarchetypeVersion=RELEASE
[INFO] Scanning for projects...
Downloading from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/apache/maven/plugins/maven-metadata.xml
Downloading from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/sonatype/plugins/maven-metadata.xml
Downloading from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/codehaus/mojo/maven-metadata.xml
Downloaded from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/apache/maven/plugins/maven-metadata.xml (14 kB at 30 kB/s)
Downloaded from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/sonatype/plugins/maven-metadata.xml (5.0 kB at 10 kB/s)
Downloaded from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/codehaus/mojo/maven-metadata.xml (24 kB at 45 kB/s)
Downloading from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
Downloaded from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml (1.1 kB at 20 kB/s)
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.2.0:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.2.0:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.2.0:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [info.magnolia.maven.archetypes:magnolia-project-archetype:1.1.0 -> https://nexus.magnolia-cms.com/content/groups/staff] found in catalog remote
Downloading from magnolia-project-archetype-repo: https://nexus.magnolia-cms.com/content/groups/staff/info/magnolia/maven/archetypes/magnolia-project-archetype/maven-metadata.xml
Downloading from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/info/magnolia/maven/archetypes/magnolia-project-archetype/maven-metadata.xml
Downloaded from magnolia.nexus: https://nexus.magnolia-cms.com/content/groups/staff/info/magnolia/maven/archetypes/magnolia-project-archetype/maven-metadata.xml (688 B at 3.0 kB/s)
[WARNING] Could not transfer metadata info.magnolia.maven.archetypes:magnolia-project-archetype/maven-metadata.xml from/to magnolia-project-archetype-repo (https://nexus.magnolia-cms.com/content/groups/staff): authentication failed for https://nexus.magnolia-cms.com/content/groups/staff/info/magnolia/maven/archetypes/magnolia-project-archetype/maven-metadata.xml, status: 401 Unauthorized
[WARNING] info.magnolia.maven.archetypes:magnolia-project-archetype/maven-metadata.xmlfailed to transfer from https://nexus.magnolia-cms.com/content/groups/staff during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of magnolia-project-archetype-repo has elapsed or updates are forced. Original error: Could not transfer metadata info.magnolia.maven.archetypes:magnolia-project-archetype/maven-metadata.xml from/to magnolia-project-archetype-repo (https://nexus.magnolia-cms.com/content/groups/staff): authentication failed for https://nexus.magnolia-cms.com/content/groups/staff/info/magnolia/maven/archetypes/magnolia-project-archetype/maven-metadata.xml, status: 401 Unauthorized


2. Set your project properties (these can be whatever you want):

Define value for property 'groupId': com.pscu
Define value for property 'artifactId': test
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.pscu: :
Define value for property 'magnolia-bundle-version': 6.2.11
Define value for property 'project-name' test: :
Confirm properties configuration:
groupId: com.pscu
artifactId: test
version: 1.0-SNAPSHOT
package: com.pscu
magnolia-bundle-version: 6.2.11
project-name: test
 Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: magnolia-project-archetype:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.pscu
[INFO] Parameter: artifactId, Value: test
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.pscu
[INFO] Parameter: packageInPathFormat, Value: com/pscu
[INFO] Parameter: magnolia-bundle-version, Value: 6.2.11
[INFO] Parameter: package, Value: com.pscu
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.pscu
[INFO] Parameter: project-name, Value: test
[INFO] Parameter: artifactId, Value: test
[INFO] Parent element not overwritten in /Users/ghost/pscu/test/test-webapp/pom.xml
[INFO] Project created from Archetype in dir: /Users/ghost/pscu/test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:47 min
[INFO] Finished at: 2021-09-02T13:20:23+02:00
[INFO] ------------------------------------------------------------------------
ghost@theMachine pscu %

You should now have a directory structure like so:

ghost@theMachine pscu % cd test
ghost@theMachine test % tree
.
├── pom.xml
└── test-webapp
├── pom.xml
└── src
└── main
└── webapp
├── WEB-INF
│   ├── bootstrap
│   │   ├── author
│   │   ├── common
│   │   └── public
│   └── config
│   └── default
└── docroot

12 directories, 2 files
ghost@theMachine test %

 

3. Edit the POM files as follows:

  • for the parent POM (pom.xml), choose option B (either comment out or delete option A, and uncomment option B)
  • for the webapp POM (test-webapp/pom.xml), choose option iii (either comment out or delete options i and ii, and uncomment option iii)

4. Exclude the problematic libraries by editing the webapp pom:

webapp pom: pom.xml


5. Build the project:

mvn clean install

6. Find the resultant WAR file:

ghost@theMachine test % ff war
running [find . -iname "*war*"] ...
./test-webapp/target/war
./test-webapp/target/test-webapp-1.0-SNAPSHOT.war
ghost@theMachine test %

Now you can move that WAR file to Tomcat and try again (smile)


  • No labels