diff --git a/src/it/MSOURCES-95/invoker.properties b/src/it/MSOURCES-95/invoker.properties new file mode 100644 index 0000000..6996f12 --- /dev/null +++ b/src/it/MSOURCES-95/invoker.properties @@ -0,0 +1,19 @@ +# 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.goals.1=${project.groupId}:${project.artifactId}:${project.version}:jar-no-fork ${project.groupId}:${project.artifactId}:${project.version}:test-jar-no-fork +invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:jar-no-fork ${project.groupId}:${project.artifactId}:${project.version}:test-jar-no-fork diff --git a/src/it/MSOURCES-95/pom.xml b/src/it/MSOURCES-95/pom.xml new file mode 100644 index 0000000..e16d8c6 --- /dev/null +++ b/src/it/MSOURCES-95/pom.xml @@ -0,0 +1,46 @@ + + + + + 4.0.0 + + org.apache.maven.its.source + empty-source-directory + 1.0-SNAPSHOT + + Test that empty source directory does not mark the JAR as outdated + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-source-plugin + @project.version@ + + + + + diff --git a/src/it/MSOURCES-95/src/main/java/.gitignore b/src/it/MSOURCES-95/src/main/java/.gitignore new file mode 100644 index 0000000..d318bb3 --- /dev/null +++ b/src/it/MSOURCES-95/src/main/java/.gitignore @@ -0,0 +1,19 @@ +# 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. + +# This file is added just because git does not support +# empty directories and we need empty directory for the test. \ No newline at end of file diff --git a/src/it/MSOURCES-95/src/main/resources/main.properties b/src/it/MSOURCES-95/src/main/resources/main.properties new file mode 100644 index 0000000..00ae6c0 --- /dev/null +++ b/src/it/MSOURCES-95/src/main/resources/main.properties @@ -0,0 +1,17 @@ +# 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. + diff --git a/src/it/MSOURCES-95/src/test/java/.gitignore b/src/it/MSOURCES-95/src/test/java/.gitignore new file mode 100644 index 0000000..d318bb3 --- /dev/null +++ b/src/it/MSOURCES-95/src/test/java/.gitignore @@ -0,0 +1,19 @@ +# 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. + +# This file is added just because git does not support +# empty directories and we need empty directory for the test. \ No newline at end of file diff --git a/src/it/MSOURCES-95/src/test/resources/main.properties b/src/it/MSOURCES-95/src/test/resources/main.properties new file mode 100644 index 0000000..00ae6c0 --- /dev/null +++ b/src/it/MSOURCES-95/src/test/resources/main.properties @@ -0,0 +1,17 @@ +# 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. + diff --git a/src/it/MSOURCES-95/verify.groovy b/src/it/MSOURCES-95/verify.groovy new file mode 100644 index 0000000..bf8d6e9 --- /dev/null +++ b/src/it/MSOURCES-95/verify.groovy @@ -0,0 +1,33 @@ +/* + * 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. + */ + +File buildLog = new File( basedir, 'build.log' ) + +String sourcesJarFileName = 'empty-source-directory-1.0-SNAPSHOT-sources.jar' +String testSourcesJarFileName = "empty-source-directory-1.0-SNAPSHOT-test-sources.jar" + +assert buildLog.exists() + +// Make sure the jars are created on the first build +assert buildLog.text =~ /(?i) Building jar: .*${sourcesJarFileName}/ +assert buildLog.text =~ /(?i) Building jar: .*${testSourcesJarFileName}/ + +// Make sure the jars are not re-created on subsequent builds +assert buildLog.text =~ /(?i) Archive .*${sourcesJarFileName} is uptodate/ +assert buildLog.text =~ /(?i) Archive .*${testSourcesJarFileName} is uptodate/ diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java index 7ae43c5..844c1fc 100644 --- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java @@ -50,7 +50,7 @@ public abstract class AbstractSourceJarMojo extends AbstractMojo { - private static final String[] DEFAULT_INCLUDES = new String[] { "**/*" }; + private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" }; private static final String[] DEFAULT_EXCLUDES = new String[] {};