Skip to content

Commit

Permalink
[MDEPLOY-206] Support parallel deployment for deployAtEnd
Browse files Browse the repository at this point in the history
Each whole module will be deployed by resolver in one thread.
We have parallel deployment on module level.
  • Loading branch information
slawekjaranowski committed Jan 31, 2023
1 parent 1fb083b commit 59bee05
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 32 deletions.
18 changes: 18 additions & 0 deletions src/it/deploy-at-end-parallel/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

invoker.mavenOpts = -Dorg.slf4j.simpleLogger.showThreadName=true
25 changes: 25 additions & 0 deletions src/it/deploy-at-end-parallel/module1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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.its.deploy.dae.parallel</groupId>
<artifactId>dae</artifactId>
<version>1.0</version>
</parent>
<artifactId>module1</artifactId>

</project>
25 changes: 25 additions & 0 deletions src/it/deploy-at-end-parallel/module2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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.its.deploy.dae.parallel</groupId>
<artifactId>dae</artifactId>
<version>1.0</version>
</parent>
<artifactId>module2</artifactId>

</project>
25 changes: 25 additions & 0 deletions src/it/deploy-at-end-parallel/module3/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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.its.deploy.dae.parallel</groupId>
<artifactId>dae</artifactId>
<version>1.0</version>
</parent>
<artifactId>module3</artifactId>

</project>
25 changes: 25 additions & 0 deletions src/it/deploy-at-end-parallel/module4/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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.its.deploy.dae.parallel</groupId>
<artifactId>dae</artifactId>
<version>1.0</version>
</parent>
<artifactId>module4</artifactId>

</project>
103 changes: 103 additions & 0 deletions src/it/deploy-at-end-parallel/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?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>

<groupId>org.apache.maven.its.deploy.dae.parallel</groupId>
<artifactId>dae</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

<description>
Tests deployment at end with parallel.
</description>

<properties>
<maven.test.skip>true</maven.test.skip>
</properties>

<distributionManagement>
<repository>
<id>it</id>
<url>file:///@remoteRepo@/deploy-at-end-parallel</url>
</repository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>@mavenCompilerPluginVersion@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<deployAtEnd>true</deployAtEnd>
<parallelThreads>4</parallelThreads>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>@mavenInstallPluginVersion@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>@mavenJarPluginVersion@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>@mavenResourcesPluginVersion@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>@mavenSourcePluginVersion@</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>@mavenSurefirePluginVersion@</version>
</plugin>
</plugins>
</build>

<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
<module>module4</module>
</modules>
</project>
26 changes: 26 additions & 0 deletions src/it/deploy-at-end-parallel/setup.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.
*/


def mockrepo = new File( remoteRepo, "deploy-at-end-parallel")
mockrepo.deleteDir()

assert !mockrepo.exists()

mockrepo.mkdirs()
37 changes: 37 additions & 0 deletions src/it/deploy-at-end-parallel/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.
*/

assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/dae/1.0/dae-1.0.pom" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module1/1.0/module1-1.0.pom" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module1/1.0/module1-1.0.jar" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module2/1.0/module2-1.0.pom" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module2/1.0/module2-1.0.jar" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module3/1.0/module3-1.0.pom" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module3/1.0/module3-1.0.jar" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module4/1.0/module4-1.0.pom" ).exists()
assert new File( remoteRepo, "deploy-at-end-parallel/org/apache/maven/its/deploy/dae/parallel/module4/1.0/module4-1.0.jar" ).exists()

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()
assert buildLog.text.contains( "[INFO] Deferring deploy for org.apache.maven.its.deploy.dae.parallel:dae:1.0 at end" )
assert buildLog.text.contains( "[INFO] Deferring deploy for org.apache.maven.its.deploy.dae.parallel:module1:1.0 at end" )
assert buildLog.text.contains( "[INFO] Deferring deploy for org.apache.maven.its.deploy.dae.parallel:module2:1.0 at end" )
assert buildLog.text.contains( "[INFO] Deferring deploy for org.apache.maven.its.deploy.dae.parallel:module3:1.0 at end" )
assert buildLog.text.contains( "[INFO] Deferring deploy for org.apache.maven.its.deploy.dae.parallel:module4:1.0 at end" )

Loading

0 comments on commit 59bee05

Please sign in to comment.