Skip to content

Commit

Permalink
archetypes refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
  • Loading branch information
senivam committed Jun 5, 2024
1 parent 63506be commit 221f30c
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 98 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -127,6 +127,5 @@
<properties>
<java.version>1.8</java.version>
<jersey.config.test.container.port>8080</jersey.config.test.container.port>
<war.mvn.plugin.version>3.4.0</war.mvn.plugin.version>
</properties>
</project>
2 changes: 1 addition & 1 deletion archetypes/jersey-heroku-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<version>${resources.mvn.plugin.version}</version>
<configuration>
<escapeString>\</escapeString>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>${compiler.mvn.plugin.version}</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
Expand Down Expand Up @@ -116,9 +116,6 @@

<properties>
<jersey.version>${project.version}</jersey.version>
<jetty.version>9.4.54.v20240208</jetty.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire.mvn.plugin.version>3.2.5</surefire.mvn.plugin.version>
<war.mvn.plugin.version>3.4.0</war.mvn.plugin.version>
</properties>
</project>
2 changes: 1 addition & 1 deletion archetypes/jersey-quickstart-grizzly2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<version>${resources.mvn.plugin.version}</version>
<configuration>
<escapeString>\</escapeString>
</configuration>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->

<archetype-descriptor
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="jersey-quickstart-webapp"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<!--<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/webapp</directory>
</fileSet>-->
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>\${junit-jupiter.version}</version>
<version>\${junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -83,8 +83,7 @@

<properties>
<jersey.version>${project.version}</jersey.version>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<junit5.version>${junit5.version}</junit5.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire.mvn.plugin.version>3.2.5</surefire.mvn.plugin.version>
</properties>
</project>
2 changes: 1 addition & 1 deletion archetypes/jersey-quickstart-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<version>${resources.mvn.plugin.version}</version>
<configuration>
<escapeString>\</escapeString>
</configuration>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->

<archetype-descriptor
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="jersey-quickstart-webapp"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/webapp</directory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>${compiler.mvn.plugin.version}</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
Expand Down Expand Up @@ -63,6 +63,5 @@
<properties>
<jersey.version>${project.version}</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<war.mvn.plugin.version>3.4.0</war.mvn.plugin.version>
</properties>
</project>
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<version>${resources.mvn.plugin.version}</version>
<!-- Add legal information, NOTICE.md and LINCENSE.md to jars -->
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -52,16 +52,21 @@ public void testPropertiesVersion() throws XmlPullParserException, IOException {
continue;
}
// Update the names with the ones in Jersey
Map.Entry<Object, Object> updatedEntry = updateEntry(pomEntry);
// Check the properties are there
if (properties.getProperty(updatedEntry.getKey().toString()) == null) {
final String key = pomEntry.getKey().toString();

if (properties.getProperty(key) == null) {
testResult.ok().append("Property ")
.append(pomEntry.getKey().toString())
.append(" from ").append(pom).println(" not in Jersey");
failed = true;
}
// check the values
else if (!properties.getProperty(updatedEntry.getKey().toString()).equals(updatedEntry.getValue())) {
else if (
//archetype property value can be a variable from the main pom.xml - check and exclude if so
!(properties.containsKey(key) && pomEntry.getValue().toString().contains(key))
&& !properties.getProperty(key).equals(pomEntry.getValue())
) {
testResult.exception().append("The property ")
.append(pomEntry.getKey().toString())
.append(" in archetype pom ")
Expand All @@ -81,25 +86,4 @@ else if (!properties.getProperty(updatedEntry.getKey().toString()).equals(update
}
}

private Map.Entry<Object, Object> updateEntry(Map.Entry<Object, Object> pomEntry) {
if (pomEntry.getKey().equals("junit-jupiter.version")) {
return new Map.Entry<Object, Object>() {
@Override
public Object getKey() {
return "junit5.version";
}

@Override
public Object getValue() {
return pomEntry.getValue();
}

@Override
public Object setValue(Object value) {
return value;
}
};
}
return pomEntry;
}
}

0 comments on commit 221f30c

Please sign in to comment.