Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-7553] New clean API with immutable model #703

Merged
merged 107 commits into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
03cfeb8
Fix build
gnodet Mar 30, 2022
5cb24c2
Check value in setter before rebuilding the internal model
gnodet Mar 31, 2022
c7ae731
Update the module names
gnodet Mar 31, 2022
ad34922
Fix velocity plugin
gnodet Mar 31, 2022
941a233
Add a with() method in the model classes
gnodet Mar 31, 2022
0663fae
Fix a few ITs
gnodet Mar 31, 2022
5052784
Fix plexus dom support
gnodet Apr 1, 2022
b1e95db
Remove debug logging
gnodet Apr 1, 2022
8c3f314
Fix velocity generator on windows
gnodet Apr 1, 2022
60c698f
Fix build consumer model merge
gnodet Apr 1, 2022
7a5e38f
Extract enums in their own classes
gnodet Apr 1, 2022
7a357e9
Fix ITs
gnodet Apr 1, 2022
a9d678c
More fixes
gnodet Apr 1, 2022
900c8af
Remove advertisement of unchecked exceptions in the methods
gnodet Apr 4, 2022
ab2845f
More fixes
gnodet Apr 5, 2022
a834c44
Import Dom type and relax List to Collection in the builders
gnodet Apr 5, 2022
57781f8
USe {@code xx} instead of <code/> in javadoc
gnodet Apr 5, 2022
73719e4
Add some javadoc to the model
gnodet Apr 5, 2022
f170038
Relax builders to use collections and leverage those
gnodet Apr 5, 2022
c850787
Use custom immutable lists
gnodet Apr 5, 2022
9eb92ba
Add immutable maps and move ROProeprties as an inner class
gnodet Apr 6, 2022
e9d7ffd
Fix writing integers and default values
gnodet Apr 6, 2022
a5cebd1
Remove duplicate call
gnodet Apr 6, 2022
8b15e36
Fix profile injection
gnodet Apr 6, 2022
006a92c
Fix xpp3 dom wrapping
gnodet Apr 6, 2022
b973df7
Fix xml node interpolation
gnodet Apr 6, 2022
db77d15
Introduce a mechanism to track changes and update the mutable model a…
gnodet Apr 6, 2022
92f1f68
Fix tracking mechanism for lists
gnodet Apr 7, 2022
007e01b
Reconcile some differences between the model templates
gnodet Apr 7, 2022
5733075
Add a header to generated files
gnodet Apr 7, 2022
d5cbb00
Retrieve root model class in a cleaner way
gnodet Apr 7, 2022
081e5ec
Actually implement the extended writer, complete merger and transform…
gnodet Apr 7, 2022
7be1f2b
Improve generated code, fix some compatibility issues with the model
gnodet Apr 7, 2022
1e97b4a
Restore ToolchainFactory compatibility
gnodet Apr 7, 2022
79f3d09
Fix class cast exception
gnodet Apr 7, 2022
22da4a6
Use pom parameters for package names
gnodet Apr 7, 2022
0502e73
Use the existing variable
gnodet Apr 7, 2022
a1f7d29
Use the same templates
gnodet Apr 8, 2022
de991f8
Do not merge distributionManagement.relocation
gnodet Apr 8, 2022
6fe60fd
Fix settings merging
gnodet Apr 8, 2022
d74f563
Correctly handle property merge
gnodet Apr 8, 2022
6e21551
Use ${root.name}
gnodet Apr 8, 2022
389707f
Handle case where a class has no defined fields
gnodet Apr 8, 2022
dd83edd
Fix toolchain ITs
gnodet Apr 8, 2022
4664e56
Fix profile activation issue
gnodet Apr 8, 2022
db0bc68
Implement more methods on the WrapperProperties
gnodet Apr 8, 2022
eb16ad4
Fix model encoding, wrapper list item removal
gnodet Apr 9, 2022
9fe6fb5
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Apr 11, 2022
6f3cc2e
Revert api changes in the maven-model-builder
gnodet Apr 11, 2022
623d153
Fix model updates between object model / xpp3 config
gnodet Apr 11, 2022
157617d
Fix model updates between object model / xpp3 config
gnodet Apr 11, 2022
e7822c2
Fix xml plexus config toString
gnodet Apr 11, 2022
7533b38
Remove the package cycle between org.apache.maven.api and org.apache.…
gnodet Apr 13, 2022
00e8533
Add some javadoc to Service interface
gnodet Apr 13, 2022
fbeab2e
Fix mojo javadoc and bring back the instantiationStrategy
gnodet Apr 13, 2022
9f3321a
Split session to allow easier reuse for stubs
gnodet Apr 14, 2022
131e96b
Add back boolean setters
gnodet Apr 14, 2022
abd74de
Restore compatibility on the ModelWriter
gnodet Apr 14, 2022
9926d3d
Add back removeXxx on model lists
gnodet Apr 14, 2022
61eb2ee
Simplifications
gnodet Apr 27, 2022
682b42a
Merge branch 'master' into m-api-immutable
gnodet Jun 21, 2022
90f04c6
Fix plexus xml duplication
gnodet Jun 21, 2022
a1604df
Fix NPE
gnodet Jun 21, 2022
2830be6
Add an @Experimental annotation to flag the api as experimental
gnodet Jun 21, 2022
065afe9
Make sure we don't do reflection on sun.nio.fs.UnixPath class
gnodet Jun 22, 2022
4f772a8
Remove commented plugin
gnodet Jun 23, 2022
3b53bcc
Add the prompter api
gnodet Jun 24, 2022
8958f05
Add the message builder to the API
gnodet Jun 24, 2022
01cfd69
Add a MessageBuilder.build() method
gnodet Jun 24, 2022
24af3b0
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Jun 30, 2022
e5496cc
Fix performance issues
gnodet Jun 30, 2022
7cb7887
Remove unneeded MappingList and use the correct variable in the template
gnodet Jul 1, 2022
6317b8c
Add suggested changes to the Mojo api
gnodet Jul 11, 2022
50e5788
Change @since javadoc tag to 4.0
gnodet Jul 11, 2022
bcbb751
Add Session.getPluginContext(Project) method
gnodet Jul 13, 2022
41cf7b3
Runtime fixes for api v4
gnodet Jul 13, 2022
477b543
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Jul 18, 2022
4e58a06
Add a VersionParser / Version / VersionRange to the new api, move Art…
gnodet Jul 19, 2022
d3398ac
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Jul 21, 2022
aa1a116
Fix possible NPE
gnodet Jul 22, 2022
2003513
Make sure plexus-utils embeds the Xpp3Dom and Xpp3DomBuilder classes
gnodet Jul 22, 2022
bec9c1c
Fix javadoc
gnodet Jul 25, 2022
05c6ba3
Implement the Listener mechanism
gnodet Jul 25, 2022
4b371f3
Various fixes in the api implementation
gnodet Aug 23, 2022
a8d0776
Merge branch 'master' into m-api-immutable
gnodet Aug 23, 2022
bf4995e
Add a mojo logging api
gnodet Aug 24, 2022
edcbde4
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Sep 2, 2022
38c6397
Fix remaining ITs
gnodet Sep 2, 2022
731f437
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Sep 15, 2022
9e46bab
Fix plexus-utils classes in IDE
gnodet Sep 16, 2022
5ccb24d
Restore MavenResolver compatibility by using default methods
gnodet Sep 16, 2022
03f9517
The raw model may not have a groupId which defaults to the parent's g…
gnodet Sep 16, 2022
8118bfa
Minor improvements
gnodet Sep 20, 2022
11a251a
Split Artifact / Coordinate
gnodet Sep 22, 2022
1a1ce01
Clean scope related api
gnodet Sep 22, 2022
55e1098
Fixes
gnodet Sep 22, 2022
444886f
Make sure Project and MojoExecution are seeded in the MojoExecutionScope
gnodet Sep 22, 2022
c2cb7d2
Add MojoExecution.getConfiguration and toString
gnodet Sep 22, 2022
f5dce02
Use the new computeIfAbsent
gnodet Sep 22, 2022
60eb1af
Use a top level class for event
gnodet Sep 22, 2022
9eda722
Fix failing unit test
gnodet Sep 22, 2022
6105c80
Merge remote-tracking branch 'origin/master' into m-api-immutable
gnodet Sep 22, 2022
15ca4f0
Move back the isSnapshot() method to Artifact
gnodet Sep 23, 2022
446032e
Remove getBaseVersion and getId from Artifact
gnodet Sep 23, 2022
8e2e0fb
Use asString instead of toString for Version and VersionRange
gnodet Sep 23, 2022
762125c
Various enhancements to the API
gnodet Sep 29, 2022
d2408f4
Introduce better coordinates, remove Artifact.getPath, move Artifact.…
gnodet Sep 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions apache-maven/src/assembly/maven/bin/m2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ load ${maven.conf}/logging
optionally ${maven.home}/lib/ext/redisson/*.jar
optionally ${maven.home}/lib/ext/hazelcast/*.jar
optionally ${maven.home}/lib/ext/*.jar
load ${maven.home}/lib/maven-*.jar
load ${maven.home}/lib/*.jar
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.io.Reader;
import java.nio.charset.StandardCharsets;

import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
import org.apache.maven.settings.v4.SettingsXpp3Reader;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
55 changes: 55 additions & 0 deletions api/maven-api-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api</artifactId>
<version>4.0.0-alpha-1-SNAPSHOT</version>
</parent>

<artifactId>maven-api-core</artifactId>
<name>Apache Maven Core API</name>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-meta</artifactId>
<version>4.0.0-alpha-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-model</artifactId>
<version>4.0.0-alpha-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-settings</artifactId>
<version>4.0.0-alpha-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-toolchain</artifactId>
<version>4.0.0-alpha-1-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
107 changes: 107 additions & 0 deletions api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package org.apache.maven.api;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;

/**
* An artifact points to a resource such as a jar file or war application.
*
* @since 4.0
*/
@Experimental
@Immutable
public interface Artifact
{

/**
* Returns a unique identifier for this artifact.
* The identifier is composed of groupId, artifactId, version, classifier, extension
* @return the unique identifier
*/
default String key()
{
return getGroupId()
+ ':' + getArtifactId()
+ ':' + getExtension()
+ ( getClassifier().length() > 0 ? ":" + getClassifier() : "" )
+ ':' + getVersion();
}

/**
* The groupId of the artifact.
*
* @return The groupId.
*/
@Nonnull
String getGroupId();

/**
* The artifactId of the artifact.
*
* @return The artifactId.
*/
@Nonnull
String getArtifactId();

/**
* The version of the artifact.
*
* @return The version.
*/
@Nonnull
Version getVersion();

/**
* The classifier of the artifact.
*
* @return The classifier or an empty string if none, never {@code null}.
*/
@Nonnull
String getClassifier();

/**
* The file extension of the artifact.
*
* @return The extension.
*/
@Nonnull
String getExtension();

/**
* Determines whether this artifact uses a snapshot version.
*
* @return {@code true} if the artifact is a snapshot, {@code false} otherwise.
* @see org.apache.maven.api.Session#isVersionSnapshot(String)
*/
boolean isSnapshot();

/**
* Shortcut for {@code session.createArtifactCoordinate(artifact)}
*
* @return an {@link ArtifactCoordinate}
* @see org.apache.maven.api.Session#createArtifactCoordinate(Artifact)
*/
@Nonnull
ArtifactCoordinate toCoordinate();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package org.apache.maven.api;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;

/**
* The {@code Coordinate} object is used to point to an {@link Artifact}
* but the version may be specified as a range instead of an exact version.
*
* @since 4.0
*/
@Experimental
@Immutable
public interface ArtifactCoordinate
{

/**
* The groupId of the artifact.
*
* @return The groupId.
*/
@Nonnull
String getGroupId();

/**
* The artifactId of the artifact.
*
* @return The artifactId.
*/
@Nonnull
String getArtifactId();

/**
* The classifier of the artifact.
*
* @return The classifier or an empty string if none, never {@code null}.
*/
@Nonnull
String getClassifier();

/**
* The version of the artifact.
*
* @return The version.
*/
@Nonnull
VersionRange getVersion();

/**
* The extension of the artifact.
*
* @return The extension or an empty string if none, never {@code null}.
*/
@Nonnull
String getExtension();

/**
* Unique id identifying this artifact
*/
default String getId()
{
return getGroupId()
+ ":" + getArtifactId()
+ ":" + getExtension()
+ ( getClassifier().isEmpty() ? "" : ":" + getClassifier() )
+ ":" + getVersion();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.apache.maven.api;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.apache.maven.api.annotations.Nonnull;

public interface Dependency extends Artifact
{

/**
* The artifact type.
*
* @return The artifact type, never {@code null}.
*/
@Nonnull
Type getType();

Scope getScope();

boolean isOptional();

/**
* Shortcut for {@code session.createDependencyCoordinate(dependency)}
*
* @return an {@link DependencyCoordinate}
* @see org.apache.maven.api.Session#createDependencyCoordinate(Dependency)
*/
@Nonnull
DependencyCoordinate toCoordinate();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.apache.maven.api;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.Nullable;
import org.apache.maven.api.annotations.Immutable;

import java.util.Collection;

/**
*
* @since 4.0
*/
@Experimental
@Immutable
public interface DependencyCoordinate extends ArtifactCoordinate
{
/**
* The type of the artifact.
*
* @return The type.
*/
@Nonnull
Type getType();

@Nonnull
Scope getScope();

@Nullable
Boolean getOptional();

@Nonnull
Collection<Exclusion> getExclusions();

}
Loading