This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 656855a4a37e4f9929b4d31ce48d236acc685b29 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Thu Feb 28 18:29:59 2019 +0100 [CAMEL-13177] Build speed: various enhancements --- components/camel-as2/camel-as2-api/pom.xml | 4 +- components/camel-blueprint/pom.xml | 35 +- .../org/apache/camel/blueprint/jaxb.index | 27 -- .../org/apache/camel/util/blueprint/jaxb.index | 23 - components/camel-box/camel-box-api/pom.xml | 4 +- components/camel-cxf/pom.xml | 32 +- components/camel-fhir/camel-fhir-api/pom.xml | 4 +- .../camel-linkedin/camel-linkedin-api/pom.xml | 4 +- components/camel-olingo2/camel-olingo2-api/pom.xml | 4 +- components/camel-olingo4/camel-olingo4-api/pom.xml | 4 +- .../camel-salesforce-maven-plugin/pom.xml | 3 +- .../camel-servicenow-maven-plugin/pom.xml | 3 +- components/camel-spring/pom.xml | 64 ++- .../camel/spring/spi/SpringTransactionPolicy.java | 2 + .../services/org/apache/camel/TransactionPolicy | 18 - .../resources/org/apache/camel/spring/jaxb.index | 26 - .../org/apache/camel/util/spring/jaxb.index | 23 - examples/pom.xml | 12 +- parent/pom.xml | 5 +- .../camel-spring-boot-dependencies/pom.xml | 56 +-- .../org/apache/camel/tools/apt/SpiProcessor.java | 31 +- .../maven/camel-api-component-maven-plugin/pom.xml | 1 + .../pom.xml | 1 + tooling/maven/camel-javadoc-plugin/pom.xml | 68 +++ .../maven/plugins/javadoc/CamelJavadocJar.java | 535 +++++++++++++++++++++ .../camel/maven/packaging/PackageJaxbMojo.java | 10 +- tooling/maven/pom.xml | 1 + .../{ServiceFactory.java => JdkService.java} | 5 +- .../camel/spi/annotations/ServiceFactory.java | 2 + 29 files changed, 820 insertions(+), 187 deletions(-) diff --git a/components/camel-as2/camel-as2-api/pom.xml b/components/camel-as2/camel-as2-api/pom.xml index d030935..e6694bc 100644 --- a/components/camel-as2/camel-as2-api/pom.xml +++ b/components/camel-as2/camel-as2-api/pom.xml @@ -91,8 +91,8 @@ <!-- to generate API Javadoc --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.camel</groupId> + <artifactId>camel-javadoc-plugin</artifactId> <executions> <execution> <id>add-javadoc</id> diff --git a/components/camel-blueprint/pom.xml b/components/camel-blueprint/pom.xml index 55b6adf..a43c316 100644 --- a/components/camel-blueprint/pom.xml +++ b/components/camel-blueprint/pom.xml @@ -121,11 +121,44 @@ <includes> <include>**/*</include> </includes> - <filtering>true</filtering> </resource> </resources> <plugins> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-package-maven-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <id>jaxb-list</id> + <goals> + <goal>generate-jaxb-list</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-generated-resources-jaxb</id> + <goals> + <goal>resources</goal> + </goals> + <phase>process-classes</phase> + <configuration> + <resources> + <resource> + <directory>${basedir}/target/generated/camel/jaxb</directory> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <!-- enrich the schemas with documentation --> <plugin> <groupId>org.apache.camel</groupId> diff --git a/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index b/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index deleted file mode 100644 index 54021b3..0000000 --- a/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index +++ /dev/null @@ -1,27 +0,0 @@ -## ------------------------------------------------------------------------ -## 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. -## ------------------------------------------------------------------------ -CamelConsumerTemplateFactoryBean -CamelContextFactoryBean -CamelEndpointFactoryBean -CamelErrorHandlerFactoryBean -CamelFluentProducerTemplateFactoryBean -CamelProducerTemplateFactoryBean -CamelThreadPoolFactoryBean -CamelRedeliveryPolicyFactoryBean -CamelRestContextFactoryBean -CamelRouteContextFactoryBean -CamelProxyFactoryBean diff --git a/components/camel-blueprint/src/main/resources/org/apache/camel/util/blueprint/jaxb.index b/components/camel-blueprint/src/main/resources/org/apache/camel/util/blueprint/jaxb.index deleted file mode 100644 index d06bae3..0000000 --- a/components/camel-blueprint/src/main/resources/org/apache/camel/util/blueprint/jaxb.index +++ /dev/null @@ -1,23 +0,0 @@ -## ------------------------------------------------------------------------ -## 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. -## ------------------------------------------------------------------------ -KeyManagersParametersFactoryBean -KeyStoreParametersFactoryBean -SecureRandomParametersFactoryBean -#SSLContextClientParametersFactoryBean -SSLContextParametersFactoryBean -#SSLContextServerParametersFactoryBean -TrustManagersParametersFactoryBean \ No newline at end of file diff --git a/components/camel-box/camel-box-api/pom.xml b/components/camel-box/camel-box-api/pom.xml index c8848f3..3c883d3 100644 --- a/components/camel-box/camel-box-api/pom.xml +++ b/components/camel-box/camel-box-api/pom.xml @@ -44,8 +44,8 @@ <!-- to generate API Javadoc --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.camel</groupId> + <artifactId>camel-javadoc-plugin</artifactId> <executions> <execution> <id>add-javadoc</id> diff --git a/components/camel-cxf/pom.xml b/components/camel-cxf/pom.xml index 3cd705f..984b4f4 100644 --- a/components/camel-cxf/pom.xml +++ b/components/camel-cxf/pom.xml @@ -335,7 +335,9 @@ <includes> <include>**/*</include> </includes> - <filtering>true</filtering> + <excludes> + <exclude>META-INF/spring.*</exclude> + </excludes> </resource> </resources> @@ -438,6 +440,34 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>copy-spring-meta-filter</id> + <phase>process-resources</phase> + <configuration> + <target> + <echo>Copying spring meta files</echo> + <copy todir="${project.build.directory}/spring-meta" preservelastmodified="true"> + <fileset dir="${project.basedir}/src/main/resources"> + <include name="**/spring.*"/> + </fileset> + </copy> + <replace file="${project.build.directory}/spring-meta/META-INF/spring.handlers" token="\\${project.version}" value="${project.version}" preservelastmodified="true" /> + <replace file="${project.build.directory}/spring-meta/META-INF/spring.schemas" token="\\${project.version}" value="${project.version}" preservelastmodified="true" /> + <copy todir="${project.build.directory}/classes" preservelastmodified="true"> + <fileset dir="${project.build.directory}/spring-meta" /> + </copy> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/components/camel-fhir/camel-fhir-api/pom.xml b/components/camel-fhir/camel-fhir-api/pom.xml index a3764b0..54ebaca 100644 --- a/components/camel-fhir/camel-fhir-api/pom.xml +++ b/components/camel-fhir/camel-fhir-api/pom.xml @@ -54,8 +54,8 @@ <!-- to generate API Javadoc --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.camel</groupId> + <artifactId>camel-javadoc-plugin</artifactId> <executions> <execution> <id>add-javadoc</id> diff --git a/components/camel-linkedin/camel-linkedin-api/pom.xml b/components/camel-linkedin/camel-linkedin-api/pom.xml index 38fa665..9961b41 100644 --- a/components/camel-linkedin/camel-linkedin-api/pom.xml +++ b/components/camel-linkedin/camel-linkedin-api/pom.xml @@ -186,8 +186,8 @@ <!-- to generate API Javadoc --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.camel</groupId> + <artifactId>camel-javadoc-plugin</artifactId> <executions> <execution> <id>add-javadoc</id> diff --git a/components/camel-olingo2/camel-olingo2-api/pom.xml b/components/camel-olingo2/camel-olingo2-api/pom.xml index 4747bcb..a621494 100644 --- a/components/camel-olingo2/camel-olingo2-api/pom.xml +++ b/components/camel-olingo2/camel-olingo2-api/pom.xml @@ -90,8 +90,8 @@ <!-- to generate API Javadoc --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.camel</groupId> + <artifactId>camel-javadoc-plugin</artifactId> <executions> <execution> <id>add-javadoc</id> diff --git a/components/camel-olingo4/camel-olingo4-api/pom.xml b/components/camel-olingo4/camel-olingo4-api/pom.xml index 101883a..2ac2e9d 100644 --- a/components/camel-olingo4/camel-olingo4-api/pom.xml +++ b/components/camel-olingo4/camel-olingo4-api/pom.xml @@ -105,8 +105,8 @@ <!-- to generate API Javadoc --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.apache.camel</groupId> + <artifactId>camel-javadoc-plugin</artifactId> <executions> <execution> <id>add-javadoc</id> diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml b/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml index c7fe0df..bc7cd13 100644 --- a/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml +++ b/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml @@ -281,10 +281,11 @@ <artifactId>maven-plugin-plugin</artifactId> <configuration> <goalPrefix>camel-salesforce</goalPrefix> + <mojoDependencies></mojoDependencies> </configuration> <executions> <execution> - <id>mojo-descriptor</id> + <id>default-descriptor</id> <goals> <goal>descriptor</goal> </goals> diff --git a/components/camel-servicenow/camel-servicenow-maven-plugin/pom.xml b/components/camel-servicenow/camel-servicenow-maven-plugin/pom.xml index 437c2d0..b81e541 100644 --- a/components/camel-servicenow/camel-servicenow-maven-plugin/pom.xml +++ b/components/camel-servicenow/camel-servicenow-maven-plugin/pom.xml @@ -225,10 +225,11 @@ <artifactId>maven-plugin-plugin</artifactId> <configuration> <goalPrefix>camel-servicenow</goalPrefix> + <mojoDependencies></mojoDependencies> </configuration> <executions> <execution> - <id>mojo-descriptor</id> + <id>default-descriptor</id> <goals> <goal>descriptor</goal> </goals> diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml index bebd23d..48e5a2f 100644 --- a/components/camel-spring/pom.xml +++ b/components/camel-spring/pom.xml @@ -186,6 +186,7 @@ <include>**/*</include> </includes> </resource> + <!-- <resource> <directory>src/main/resources</directory> <includes> @@ -193,10 +194,45 @@ </includes> <filtering>true</filtering> </resource> + --> </resources> <plugins> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-package-maven-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <id>jaxb-list</id> + <goals> + <goal>generate-jaxb-list</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-generated-resources-jaxb</id> + <goals> + <goal>resources</goal> + </goals> + <phase>process-classes</phase> + <configuration> + <resources> + <resource> + <directory>${basedir}/target/generated/camel/jaxb</directory> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <!-- Push the execution order of the maven-bundle-plugin further to the end. That's why we add it here again. --> <plugin> <groupId>org.apache.felix</groupId> @@ -308,11 +344,11 @@ <configuration> <target> <echo>Copying XSD schema to be included in JAR</echo> - <copy file="${project.build.directory}/classes/camel-spring.xsd" tofile="${project.build.directory}/schema/camel-spring.xsd" /> - <copy file="${project.build.directory}/classes/camel-spring.xsd" tofile="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd" /> - <replace file="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd" token="http://camel.apache.org/schema/spring" value="http://camel.apache.org/schema/spring/v${camel.schema.version}" /> + <copy file="${project.build.directory}/classes/camel-spring.xsd" tofile="${project.build.directory}/schema/camel-spring.xsd" preservelastmodified="true" /> + <copy file="${project.build.directory}/classes/camel-spring.xsd" tofile="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd" preservelastmodified="true" /> + <replace file="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd" token=""http://camel.apache.org/schema/spring"" value=""http://camel.apache.org/schema/spring/v${camel.schema.version}"" preservelastmodified="true" /> <!-- copy modified schemas back again in classes so they are included in the JAR --> - <copy todir="${project.build.directory}/classes"> + <copy todir="${project.build.directory}/classes" preservelastmodified="true"> <fileset dir="${project.build.directory}/schema" /> </copy> </target> @@ -322,6 +358,26 @@ </goals> </execution> <execution> + <id>copy-spring-meta-filter</id> + <phase>process-resources</phase> + <configuration> + <target> + <echo>Copying spring meta files</echo> + <copy todir="${project.build.directory}/spring-meta" preservelastmodified="true"> + <fileset dir="${project.basedir}/src/main/resources" /> + </copy> + <replace file="${project.build.directory}/spring-meta/META-INF/spring.handlers" token="\\${camel.schema.version}" value="${camel.schema.version}" preservelastmodified="true" /> + <replace file="${project.build.directory}/spring-meta/META-INF/spring.schemas" token="\\${camel.schema.version}" value="${camel.schema.version}" preservelastmodified="true" /> + <copy todir="${project.build.directory}/classes" preservelastmodified="true"> + <fileset dir="${project.build.directory}/spring-meta" /> + </copy> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> <id>Create JAR for test</id> <phase>process-test-classes</phase> <configuration> diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java index bdcda5c..a44f4d8 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java @@ -24,6 +24,7 @@ import org.apache.camel.builder.ErrorHandlerBuilderRef; import org.apache.camel.model.RouteDefinition; import org.apache.camel.spi.RouteContext; import org.apache.camel.spi.TransactedPolicy; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,6 +34,7 @@ import org.springframework.transaction.support.TransactionTemplate; /** * Wraps the processor in a Spring transaction */ +@JdkService(TransactedPolicy.class) public class SpringTransactionPolicy implements TransactedPolicy { private static final Logger LOG = LoggerFactory.getLogger(SpringTransactionPolicy.class); private TransactionTemplate template; diff --git a/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/TransactionPolicy b/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/TransactionPolicy deleted file mode 100644 index 43774ff..0000000 --- a/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/TransactionPolicy +++ /dev/null @@ -1,18 +0,0 @@ -# -# 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. -# - -class=org.apache.camel.spring.spi.SpringTransactionPolicy \ No newline at end of file diff --git a/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index b/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index deleted file mode 100644 index feb4365..0000000 --- a/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index +++ /dev/null @@ -1,26 +0,0 @@ -## ------------------------------------------------------------------------ -## 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. -## ------------------------------------------------------------------------ -CamelBeanPostProcessor -CamelConsumerTemplateFactoryBean -CamelContextFactoryBean -CamelEndpointFactoryBean -CamelFluentProducerTemplateFactoryBean -CamelProducerTemplateFactoryBean -CamelRedeliveryPolicyFactoryBean -CamelRestContextFactoryBean -CamelRouteContextFactoryBean -CamelThreadPoolFactoryBean diff --git a/components/camel-spring/src/main/resources/org/apache/camel/util/spring/jaxb.index b/components/camel-spring/src/main/resources/org/apache/camel/util/spring/jaxb.index deleted file mode 100644 index d06bae3..0000000 --- a/components/camel-spring/src/main/resources/org/apache/camel/util/spring/jaxb.index +++ /dev/null @@ -1,23 +0,0 @@ -## ------------------------------------------------------------------------ -## 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. -## ------------------------------------------------------------------------ -KeyManagersParametersFactoryBean -KeyStoreParametersFactoryBean -SecureRandomParametersFactoryBean -#SSLContextClientParametersFactoryBean -SSLContextParametersFactoryBean -#SSLContextServerParametersFactoryBean -TrustManagersParametersFactoryBean \ No newline at end of file diff --git a/examples/pom.xml b/examples/pom.xml index ae35476..ab39b58 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -163,12 +163,12 @@ </dependencyManagement> <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> + <!--<resources>--> + <!--<resource>--> + <!--<directory>src/main/resources</directory>--> + <!--<filtering>true</filtering>--> + <!--</resource>--> + <!--</resources>--> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/parent/pom.xml b/parent/pom.xml index ad8f061..5d3ec9e 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -161,7 +161,7 @@ <couchbase-client-version>1.4.13</couchbase-client-version> <couchbase-client-bundle-version>1.4.13_1</couchbase-client-bundle-version> <curator-version>2.12.0</curator-version> - <cxf-version>3.3.0</cxf-version> + <cxf-version>3.3.1-SNAPSHOT</cxf-version> <cxf-version-range>[3.1,4.0)</cxf-version-range> <cxf-xjc-plugin-version>3.2.0</cxf-xjc-plugin-version> <cxf-xjc-utils-version>3.2.0</cxf-xjc-utils-version> @@ -463,7 +463,7 @@ <maven-archetype-packaging-version>2.3</maven-archetype-packaging-version> <maven-assembly-plugin-version>3.0.0</maven-assembly-plugin-version> <maven-bundle-version>${maven-bundle-plugin-version}</maven-bundle-version> - <maven-bundle-plugin-version>4.1.0</maven-bundle-plugin-version> + <maven-bundle-plugin-version>4.1.1-SNAPSHOT</maven-bundle-plugin-version> <maven-checkstyle-plugin-version>3.0.0</maven-checkstyle-plugin-version> <maven-checkstyle-version>7.6.1</maven-checkstyle-version> <maven-owasp-plugin-version>4.0.2</maven-owasp-plugin-version> @@ -5532,6 +5532,7 @@ <version>${maven-bundle-plugin-version}</version> <extensions>false</extensions> <configuration> + <supportIncrementalBuild>true</supportIncrementalBuild> <excludeDependencies>${camel.osgi.exclude.dependencies}</excludeDependencies> <instructions> <Bundle-Name>${project.artifactId}</Bundle-Name> diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml index 1fdaa1f..8902477 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml @@ -3246,142 +3246,142 @@ <dependency> <groupId>org.apache.cxf.services.sts</groupId> <artifactId>cxf-services-sts-core</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf.services.ws-discovery</groupId> <artifactId>cxf-services-ws-discovery-api</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-core</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-bindings-soap</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-bindings-xml</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-databinding-jaxb</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-features-clustering</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-features-logging</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxrs</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-simple</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-management</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-client</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-extension-providers</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-security-oauth2</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-jetty</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-jms</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-local</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-addr</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-mex</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-policy</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-rm</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-security</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-ws-security-oauth2</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-wsdl</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-testutils</artifactId> - <version>3.3.0</version> + <version>3.3.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.ftpserver</groupId> diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/SpiProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/SpiProcessor.java index cb8147c..bde15ea 100644 --- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/SpiProcessor.java +++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/SpiProcessor.java @@ -48,17 +48,26 @@ public class SpiProcessor extends AbstractCamelAnnotationProcessor { if (sf != null) { String pvals = pam.getElementValues().values().iterator().next().getValue().toString(); for (String pval : pvals.split(",")) { - FileObject resource = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", - "META-INF/services/org/apache/camel/" + sf.value() + "/" + pval, element); - try (Writer w = resource.openWriter()) { - w.append("# Generated by camel annotation processor\n"); - w.append("class=").append(javaTypeName).append("\n"); - for (AnnotationMirror am : element.getAnnotationMirrors()) { - SubServiceFactory factory = am.getAnnotationType().asElement().getAnnotation(SubServiceFactory.class); - if (factory != null) { - String key = factory.value(); - String val = am.getElementValues().values().iterator().next().getValue().toString(); - w.append(key).append(".class=").append(val).append("\n"); + if (ServiceFactory.JDK_SERVICE.equals(sf.value())) { + FileObject resource = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", + "META-INF/services/" + pval.replace('.', '/'), element); + try (Writer w = resource.openWriter()) { + w.append("# Generated by camel annotation processor\n"); + w.append("class=").append(javaTypeName).append("\n"); + } + } else { + FileObject resource = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", + "META-INF/services/org/apache/camel/" + sf.value() + "/" + pval, element); + try (Writer w = resource.openWriter()) { + w.append("# Generated by camel annotation processor\n"); + w.append("class=").append(javaTypeName).append("\n"); + for (AnnotationMirror am : element.getAnnotationMirrors()) { + SubServiceFactory factory = am.getAnnotationType().asElement().getAnnotation(SubServiceFactory.class); + if (factory != null) { + String key = factory.value(); + String val = am.getElementValues().values().iterator().next().getValue().toString(); + w.append(key).append(".class=").append(val).append("\n"); + } } } } diff --git a/tooling/maven/camel-api-component-maven-plugin/pom.xml b/tooling/maven/camel-api-component-maven-plugin/pom.xml index 68fe87d..5be78ee 100644 --- a/tooling/maven/camel-api-component-maven-plugin/pom.xml +++ b/tooling/maven/camel-api-component-maven-plugin/pom.xml @@ -179,6 +179,7 @@ <configuration> <!-- see http://jira.codehaus.org/browse/MNG-5346 --> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> + <mojoDependencies></mojoDependencies> </configuration> <executions> <execution> diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml index 1484a63..fab261e 100644 --- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml +++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml @@ -151,6 +151,7 @@ <configuration> <!-- see http://jira.codehaus.org/browse/MNG-5346 --> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> + <mojoDependencies></mojoDependencies> </configuration> <executions> <execution> diff --git a/tooling/maven/camel-javadoc-plugin/pom.xml b/tooling/maven/camel-javadoc-plugin/pom.xml new file mode 100644 index 0000000..f493c2e --- /dev/null +++ b/tooling/maven/camel-javadoc-plugin/pom.xml @@ -0,0 +1,68 @@ +<?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.camel</groupId> + <artifactId>maven-plugins</artifactId> + <version>3.0.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-javadoc-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>Camel :: Maven Plugins :: Enhanced javadoc plugin</name> + <description>Javadoc plugin detecting stale input</description> + + <build> + <plugins> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>${maven-javadoc-plugin-version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>${maven-plugin-annotations-version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-archiver</artifactId> + <version>3.3.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-archiver</artifactId> + <version>3.7.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>3.1.0</version> + </dependency> + </dependencies> + +</project> diff --git a/tooling/maven/camel-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/CamelJavadocJar.java b/tooling/maven/camel-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/CamelJavadocJar.java new file mode 100644 index 0000000..041f9cb --- /dev/null +++ b/tooling/maven/camel-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/CamelJavadocJar.java @@ -0,0 +1,535 @@ +package org.apache.maven.plugins.javadoc; + +/* + * 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.archiver.MavenArchiveConfiguration; +import org.apache.maven.archiver.MavenArchiver; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DependencyResolutionRequiredException; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.model.Resource; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.plugins.javadoc.AbstractJavadocMojo; +import org.apache.maven.plugins.javadoc.JavadocArchiveConfiguration; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectHelper; +import org.apache.maven.reporting.MavenReportException; +import org.codehaus.plexus.archiver.Archiver; +import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.jar.JarArchiver; +import org.codehaus.plexus.archiver.jar.Manifest; +import org.codehaus.plexus.archiver.jar.ManifestException; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOError; +import java.io.IOException; +import java.io.Writer; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.Set; +import java.util.TreeSet; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipFile; + +/** + * Bundles the Javadoc documentation for <code>main Java code</code> in an <b>NON aggregator</b> project into + * a jar using the standard <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/">Javadoc Tool</a>. + * + * @version $Id: JavadocJar.java 1752018 2016-07-09 16:35:25Z rfscholte $ + * @since 2.0 + */ +@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE, + threadSafe = true ) +public class CamelJavadocJar + extends AbstractJavadocMojo +{ + /** + * Includes all generated Javadoc files + */ + private static final String[] DEFAULT_INCLUDES = new String[]{ "**/**" }; + + /** + * Excludes all processing files. + * + * @see AbstractJavadocMojo#DEBUG_JAVADOC_SCRIPT_NAME + * @see AbstractJavadocMojo#OPTIONS_FILE_NAME + * @see AbstractJavadocMojo#PACKAGES_FILE_NAME + * @see AbstractJavadocMojo#ARGFILE_FILE_NAME + * @see AbstractJavadocMojo#FILES_FILE_NAME + */ + private static final String[] DEFAULT_EXCLUDES = + new String[]{ DEBUG_JAVADOC_SCRIPT_NAME, OPTIONS_FILE_NAME, PACKAGES_FILE_NAME, ARGFILE_FILE_NAME, + FILES_FILE_NAME }; + + // ---------------------------------------------------------------------- + // Mojo components + // ---------------------------------------------------------------------- + + /** + * Used for attaching the artifact in the project. + */ + @Component + private MavenProjectHelper projectHelper; + + /** + * The Jar archiver. + * + * @since 2.5 + */ + @Component( role = Archiver.class, hint = "jar" ) + private JarArchiver jarArchiver; + + // ---------------------------------------------------------------------- + // Mojo Parameters + // ---------------------------------------------------------------------- + + /** + * Specifies the destination directory where javadoc saves the generated HTML files. + * See <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#d">d</a>. + * + * @deprecated + */ + @Deprecated + @Parameter( property = "destDir" ) + private File destDir; + + /** + * Specifies the directory where the generated jar file will be put. + */ + @Parameter( property = "project.build.directory" ) + private String jarOutputDirectory; + + /** + * Specifies the filename that will be used for the generated jar file. Please note that <code>-javadoc</code> + * or <code>-test-javadoc</code> will be appended to the file name. + */ + @Parameter( property = "project.build.finalName" ) + private String finalName; + + /** + * Specifies whether to attach the generated artifact to the project helper. + * <br/> + */ + @Parameter( property = "attach", defaultValue = "true" ) + private boolean attach; + + /** + * The archive configuration to use. + * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>. + * + * @since 2.5 + */ + @Parameter + private MavenArchiveConfiguration archive = new JavadocArchiveConfiguration() { + { + setForced(false); + } + }; + + /** + * Path to the default MANIFEST file to use. It will be used if + * <code>useDefaultManifestFile</code> is set to <code>true</code>. + * + * @since 2.5 + */ + @Parameter( defaultValue = "${project.build.outputDirectory}/META-INF/MANIFEST.MF", required = true, + readonly = true ) + private File defaultManifestFile; + + /** + * Set this to <code>true</code> to enable the use of the <code>defaultManifestFile</code>. + * <br/> + * + * @since 2.5 + */ + @Parameter( defaultValue = "false" ) + private boolean useDefaultManifestFile; + + /** + * @since 2.10 + */ + @Parameter( property = "maven.javadoc.classifier", defaultValue = "javadoc", required = true ) + private String classifier; + + /** + * Specifies the destination directory where javadoc saves the generated HTML files. + * <br> + * @see <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#d">d</a> option + */ + @Parameter( defaultValue = "${project.build.directory}/apidocstmp", required = true ) + protected File intermediateDirectory; + + /** {@inheritDoc} */ + @Override + public void doExecute() + throws MojoExecutionException + { + if ( skip ) + { + getLog().info( "Skipping javadoc generation" ); + return; + } + + try { + Field f = AbstractJavadocMojo.class.getDeclaredField("additionalOptions"); + f.setAccessible(true); + String[] additionalOptions = (String[]) f.get(this); + if (additionalOptions == null || additionalOptions.length == 0) { + additionalOptions = new String[] { "-notimestamp" }; + } else { + List<String> l = new ArrayList<>(Arrays.asList(additionalOptions)); + l.add("-notimestamp"); + additionalOptions = l.toArray(new String[0]); + } + f.set(this, additionalOptions); + } catch (Exception e) { + throw new MojoExecutionException("Unable to set javadoc options", e); + } + + File innerDestDir = this.destDir; + if ( innerDestDir == null ) + { + innerDestDir = new File( getOutputDirectory() ); + } + + if ( !( "pom".equalsIgnoreCase( project.getPackaging() ) && isAggregator() ) ) + { + ArtifactHandler artifactHandler = project.getArtifact().getArtifactHandler(); + if ( !"java".equals( artifactHandler.getLanguage() ) ) + { + getLog().info( "Not executing Javadoc as the project is not a Java classpath-capable package" ); + return; + } + } + + try + { + executeReport( Locale.getDefault() ); + } + catch ( MavenReportException e ) + { + failOnError( "MavenReportException: Error while generating Javadoc", e ); + } + catch ( RuntimeException e ) + { + failOnError( "RuntimeException: Error while generating Javadoc", e ); + } + + if ( innerDestDir.exists() ) + { + try + { + Path inputDir = innerDestDir.toPath(); + Path outputDir = intermediateDirectory.toPath(); + Files.createDirectories(outputDir); + Set<Path> input = getAllRelativeFiles(inputDir); + Set<Path> output = getAllRelativeFiles(outputDir); + // remove deleted files + output.removeAll(input); + output.remove(Paths.get("META-INF")); + output.remove(Paths.get("META-INF/MANIFEST.MF")); + for (Path p : output) { + Files.delete(outputDir.resolve(p)); + } + // copy all files + for (Path p : input) { + copy(inputDir.resolve(p), outputDir.resolve(p)); + } + + File outputFile = generateArchive( intermediateDirectory, finalName + "-" + getClassifier() + ".jar" ); + + if ( !attach ) + { + getLog().info( "NOT adding javadoc to attached artifacts list." ); + } + else + { + // TODO: these introduced dependencies on the project are going to become problematic - can we export it + // through metadata instead? + projectHelper.attachArtifact( project, "javadoc", getClassifier(), outputFile ); + } + } + catch ( ArchiverException e ) + { + failOnError( "ArchiverException: Error while creating archive", e ); + } + catch ( IOException e ) + { + failOnError( "IOException: Error while creating archive", e ); + } + catch ( RuntimeException e ) + { + failOnError( "RuntimeException: Error while creating archive", e ); + } + } + } + + /* + private void writeIncrementalInfo(MavenProject project) throws MojoExecutionException { + try { + Path cacheData = getIncrementalDataPath(project); + String curdata = getIncrementalData(); + Files.createDirectories(cacheData.getParent()); + try (Writer w = Files.newBufferedWriter(cacheData)) { + w.append(curdata); + } + } catch (IOException e) { + throw new MojoExecutionException("Error checking manifest uptodate status", e); + } + } + + private boolean isUpToDate(MavenProject project) throws MojoExecutionException { + long t0 = System.currentTimeMillis(); + try { + Path cacheData = getIncrementalDataPath(project); + String prvdata; + if (Files.isRegularFile(cacheData)) { + prvdata = new String(Files.readAllBytes(cacheData), StandardCharsets.UTF_8); + } else { + prvdata = null; + } + String curdata = getIncrementalData(); + if (curdata.equals(prvdata)) { + long lastmod = Files.getLastModifiedTime(cacheData).toMillis(); + Set<String> stale = Stream.concat(Stream.of(new File(project.getBuild().getOutputDirectory())), + project.getArtifacts().stream().map(Artifact::getFile)) + .flatMap(f -> newer(lastmod, f)) + .collect(Collectors.toSet()); + if (!stale.isEmpty()) { + getLog().info("Stale files: " + stale.stream() + .collect(Collectors.joining(", "))); + } else { + // everything is in order, skip + getLog().info("Skipping manifest generation, everything is up to date."); + return true; + } + } else { + if (prvdata == null) { + getLog().info("No previous run data found, generating manifest."); + } else { + getLog().info("Configuration changed, re-generating manifest."); + } + } + } catch (IOException e) { + throw new MojoExecutionException("Error checking manifest uptodate status", e); + } finally { + long t1 = System.currentTimeMillis(); + getLog().warn("isUpToDate took " + (t1 - t0) + " ms"); + } + return false; + } + + private String getIncrementalData() { + return getInstructions().entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()) + .collect(Collectors.joining("\n", "", "\n")); + } + + private Path getIncrementalDataPath(MavenProject project) { + return Paths.get(project.getBuild().getDirectory(), "camel-javadoc-plugin", + "org.apache.camel_camel-javadoc-plugin_javadoc_xx"); + } + + private long lastmod(Path p) { + try { + return Files.getLastModifiedTime(p).toMillis(); + } catch (IOException e) { + return 0; + } + } + + private Stream<String> newer(long lastmod, File file) { + try { + if (file.isDirectory()) { + return Files.walk(file.toPath()) + .filter(Files::isRegularFile) + .filter(p -> lastmod(p) > lastmod) + .map(Path::toString); + } else if (file.isFile()) { + if (lastmod(file.toPath()) > lastmod) { + if (file.getName().endsWith(".jar")) { + try (ZipFile zf = new ZipFile(file)) { + return zf.stream() + .filter(ze -> !ze.isDirectory()) + .filter(ze -> ze.getLastModifiedTime().toMillis() > lastmod) + .map(ze -> file.toString() + "!" + ze.getName()) + .collect(Collectors.toList()) + .stream(); + } + } else { + return Stream.of(file.toString()); + } + } else { + return Stream.empty(); + } + } else { + return Stream.empty(); + } + } catch (IOException e) { + throw new IOError(e); + } + } + */ + + void copy(Path in, Path out) throws IOException { + if (Files.isDirectory(in)) { + Files.createDirectories(out); + } else if (Files.isRegularFile(in)) { + byte[] dataIn = Files.readAllBytes(in); + if (Files.isRegularFile(out) && Files.isReadable(out)) { + byte[] dataOut = Files.readAllBytes(out); + if (Arrays.equals(dataIn, dataOut)) { + return; + } + } + Files.createDirectories(out.getParent()); + Files.copy(in, out, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); + } + } + + TreeSet<Path> getAllRelativeFiles(Path dir) throws IOException { + return Files.walk(dir) + .map(dir::relativize) + .collect(Collectors.toCollection(TreeSet::new)); + } + + // ---------------------------------------------------------------------- + // Protected methods + // ---------------------------------------------------------------------- + + /** + * @return the wanted classifier, i.e. <code>javadoc</code> or <code>test-javadoc</code> + */ + protected String getClassifier() + { + return classifier; + } + + // ---------------------------------------------------------------------- + // private methods + // ---------------------------------------------------------------------- + + /** + * Method that creates the jar file + * + * @param javadocFiles the directory where the generated jar file will be put + * @param jarFileName the filename of the generated jar file + * @return a File object that contains the generated jar file + * @throws ArchiverException {@link ArchiverException} + * @throws IOException {@link IOException} + */ + private File generateArchive( File javadocFiles, String jarFileName ) + throws ArchiverException, IOException + { + File javadocJar = new File( jarOutputDirectory, jarFileName ); + + MavenArchiver archiver = new MavenArchiver(); + archiver.setArchiver( jarArchiver ); + archiver.setOutputFile( javadocJar ); + + File contentDirectory = javadocFiles; + if ( !contentDirectory.exists() ) + { + getLog().warn( "JAR will be empty - no content was marked for inclusion!" ); + } + else + { + archiver.getArchiver().addDirectory( contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES ); + } + + List<Resource> resources = project.getBuild().getResources(); + + for ( Resource r : resources ) + { + if ( r.getDirectory().endsWith( "maven-shared-archive-resources" ) ) + { + archiver.getArchiver().addDirectory( new File( r.getDirectory() ) ); + } + } + + if ( useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null ) + { + getLog().info( "Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath() ); + archive.setManifestFile( defaultManifestFile ); + } + + if (archive.getManifestFile() == null) + { + try + { + + Manifest manifest = archiver.getManifest(session, project, archive); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + manifest.write(baos); + Path man = javadocFiles.toPath().resolve("META-INF/MANIFEST.MF"); + byte[] data = null; + if (Files.isRegularFile(man)) { + data = Files.readAllBytes(man); + } + if (!Arrays.equals(data, baos.toByteArray())) { + Files.createDirectories(man.getParent()); + Files.copy(new ByteArrayInputStream(baos.toByteArray()), man, StandardCopyOption.REPLACE_EXISTING); + } + archive.setManifestFile(man.toFile()); + } + catch ( ManifestException e ) + { + throw new ArchiverException( "ManifestException: " + e.getMessage(), e ); + } + catch ( DependencyResolutionRequiredException e ) + { + throw new ArchiverException( "DependencyResolutionRequiredException: " + e.getMessage(), e ); + } + } + + try + { + archiver.createArchive( session, project, archive ); + } + catch ( ManifestException e ) + { + throw new ArchiverException( "ManifestException: " + e.getMessage(), e ); + } + catch ( DependencyResolutionRequiredException e ) + { + throw new ArchiverException( "DependencyResolutionRequiredException: " + e.getMessage(), e ); + } + + return javadocJar; + } +} diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageJaxbMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageJaxbMojo.java index 486559c..8ddefd6 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageJaxbMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageJaxbMojo.java @@ -109,7 +109,15 @@ public class PackageJaxbMojo extends AbstractGeneratorMojo { Path jaxbIndexDir = jaxbIndexOutDir.toPath(); int count = 0; for (Map.Entry<String, Set<String>> entry : byPackage.entrySet()) { - Path file = jaxbIndexDir.resolve(entry.getKey().replace('.', '/')).resolve("jaxb.index"); + String fn = entry.getKey().replace('.', '/') + "/jaxb.index"; + if (project.getCompileSourceRoots().stream() + .map(Paths::get) + .map(p -> p.resolve(fn)) + .findAny() + .isPresent()) { + continue; + } + Path file = jaxbIndexDir.resolve(fn); StringBuilder sb = new StringBuilder(); sb.append("# " + GENERATED_MSG + NL); for (String s : entry.getValue()) { diff --git a/tooling/maven/pom.xml b/tooling/maven/pom.xml index 6feeb8e..8fb2201 100644 --- a/tooling/maven/pom.xml +++ b/tooling/maven/pom.xml @@ -38,6 +38,7 @@ <module>camel-api-component-maven-plugin</module> <module>bom-generator-maven-plugin</module> <module>camel-restdsl-swagger-plugin</module> + <module>camel-javadoc-plugin</module> </modules> <!-- Apply to children. --> diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/JdkService.java similarity index 92% copy from tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java copy to tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/JdkService.java index 09171dc..c03d2f9 100644 --- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java +++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/JdkService.java @@ -25,8 +25,9 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Documented @Target({ElementType.TYPE }) -public @interface ServiceFactory { +@ServiceFactory(ServiceFactory.JDK_SERVICE) +public @interface JdkService { - String value(); + Class value(); } diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java index 09171dc..d0021cb 100644 --- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java +++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/ServiceFactory.java @@ -27,6 +27,8 @@ import java.lang.annotation.Target; @Target({ElementType.TYPE }) public @interface ServiceFactory { + String JDK_SERVICE = "#jdk#"; + String value(); }