pax_global_header 0000666 0000000 0000000 00000000064 12624061460 0014513 g ustar 00root root 0000000 0000000 52 comment=ec5f3f2d514d7670e6eab41c8ca44058f93fb037
templating-maven-plugin-templating-maven-plugin-1.0.0/ 0000775 0000000 0000000 00000000000 12624061460 0023017 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/.gitignore 0000664 0000000 0000000 00000000345 12624061460 0025011 0 ustar 00root root 0000000 0000000 # Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# IDE's
.settings
.classpath
.project
*.iml
.idea
templating-maven-plugin-templating-maven-plugin-1.0.0/.travis.yml 0000664 0000000 0000000 00000000142 12624061460 0025125 0 ustar 00root root 0000000 0000000 ---
language: java
script: mvn verify -B
jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
- openjdk6
templating-maven-plugin-templating-maven-plugin-1.0.0/LICENSE 0000664 0000000 0000000 00000026052 12624061460 0024031 0 ustar 00root root 0000000 0000000 Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2013 MojoHaus
Licensed 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.
templating-maven-plugin-templating-maven-plugin-1.0.0/README.md 0000664 0000000 0000000 00000001615 12624061460 0024301 0 ustar 00root root 0000000 0000000 Templating Maven Plugin
=======================
[](http://search.maven.org/#search%7Cga%7C1%7Ctemplating-maven-plugin) [](https://travis-ci.org/mojohaus/templating-maven-plugin)
The [Templating Maven Plugin](http://www.mojohaus.org/templating-maven-plugin/)
handles copying files from a source to a given output directory, while
filtering them. This plugin is useful to filter Java Source Code if you need
for example to have things in that code replaced with some properties values.
## Releasing
* Make sure `gpg-agent` is running.
* Execute `mvn -B release:prepare release:perform`
For publishing the site do the following:
```
cd target/checkout
mvn verify site site:stage scm-publish:publish-scm
```
templating-maven-plugin-templating-maven-plugin-1.0.0/pom.xml 0000664 0000000 0000000 00000016762 12624061460 0024350 0 ustar 00root root 0000000 0000000
4.0.0org.codehaus.mojomojo-parent38templating-maven-plugin1.0.0maven-pluginhttp://www.mojohaus.org/templating-maven-pluginTemplating Maven Plugin
That project was designed to offer the Maven Right Way® :-) to filter sources.
2013The Apache Software License, Version 2.0http://www.apache.org/licenses/LICENSE-2.0.txtrepoKarl Heinz Marbaise+1khmarbaise@apache.orgDeveloperBaptiste Mathus+1DeveloperStephen Connollystephen.alan.connolly@gmail.comDeveloper0Krzysztof Suszyńskicardil@o2.plhttp://suszynski.org/${mavenVersion}scm:git:https://github.com/mojohaus/templating-maven-plugin.gitscm:git:ssh://git@github.com/mojohaus/templating-maven-plugin.githttps://github.com/mojohaus/templating-maven-plugintemplating-maven-plugin-1.0.0GitHubhttps://github.com/mojohaus/templating-maven-plugin/issues/Travis-CIhttps://travis-ci.org/mojohaus/templating-maven-plugin2.2.11.51.3target/staging/${project.artifactId}org.apache.maven.pluginsmaven-plugin-plugintruemojo-descriptordescriptorhelp-goalhelpmojoorg.apache.mavenmaven-model${mavenVersion}org.apache.mavenmaven-project${mavenVersion}org.apache.mavenmaven-core${mavenVersion}org.apache.mavenmaven-plugin-apiorg.apache.mavenmaven-artifact${mavenVersion}org.codehaus.plexusplexus-utils3.0.22org.codehaus.plexusplexus-interpolation1.21org.apache.maven.plugin-toolsmaven-plugin-annotationsprovidedorg.apache.maven.sharedmaven-filtering${mavenFilteringVersion}org.sonatype.plexusplexus-build-api0.0.7junitjunittestorg.mockitomockito-core1.9.5testorg.assertjassertj-core1.7.1testorg.apache.maven.pluginsmaven-plugin-pluginrun-itsskipTests!truemaven-invoker-plugin${project.build.directory}/ittrueverify${project.build.directory}/local-reposrc/it/settings.xmlintegration-testinstallrun
templating-maven-plugin-templating-maven-plugin-1.0.0/src/ 0000775 0000000 0000000 00000000000 12624061460 0023606 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/ 0000775 0000000 0000000 00000000000 12624061460 0024222 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/ 0000775 0000000 0000000 00000000000 12624061460 0025352 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/colors.properties 0000664 0000000 0000000 00000000071 12624061460 0030767 0 ustar 00root root 0000000 0000000 first-color = red
second-color = green
third-color = blue templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/pom.xml 0000664 0000000 0000000 00000001527 12624061460 0026674 0 ustar 00root root 0000000 0000000 4.0.0org.codehaus.mojo.templating.itmojo-20140.0.1-SNAPSHOTMOJO-2014colors.properties@project.groupId@@project.artifactId@@project.version@filter-srcfilter-sources
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/ 0000775 0000000 0000000 00000000000 12624061460 0026141 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/ 0000775 0000000 0000000 00000000000 12624061460 0027065 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/ 0000775 0000000 0000000 00000000000 12624061460 0032002 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/org/ 0000775 0000000 0000000 00000000000 12624061460 0032571 5 ustar 00root root 0000000 0000000 codehaus/ 0000775 0000000 0000000 00000000000 12624061460 0034305 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/org mojo/ 0000775 0000000 0000000 00000000000 12624061460 0035251 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/org/codehaus templating/ 0000775 0000000 0000000 00000000000 12624061460 0037415 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/org/codehaus/mojo it/ 0000775 0000000 0000000 00000000000 12624061460 0040031 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/org/codehaus/mojo/templating Colors.java 0000664 0000000 0000000 00000000371 12624061460 0042136 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/src/main/java-templates/org/codehaus/mojo/templating/it package org.codehaus.mojo.templating.it;
public class Colors {
public static final String FIRST_COLOR = "${first-color}";
public static final String SECOND_COLOR = "${second-color}";
public static final String THIRD_COLOR = "${third-color}";
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/MOJO-2014/verify.groovy 0000664 0000000 0000000 00000002724 12624061460 0030132 0 ustar 00root root 0000000 0000000 /*
* 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 buildLog = new File(basedir, 'build.log')
assert buildLog.exists()
assert buildLog.text.contains("BUILD SUCCESS")
assert new File(basedir, 'target').exists()
assert new File(basedir, 'target/generated-sources/java-templates/org/codehaus/mojo/templating/it/Colors.java').exists()
def javaClass = new File(basedir, 'target/generated-sources/java-templates/org/codehaus/mojo/templating/it/Colors.java')
assert javaClass.text.contains('public static final String FIRST_COLOR = "red"')
assert javaClass.text.contains('public static final String SECOND_COLOR = "green"')
assert javaClass.text.contains('public static final String THIRD_COLOR = "blue"')
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/ 0000775 0000000 0000000 00000000000 12624061460 0030601 5 ustar 00root root 0000000 0000000 invoker.properties 0000664 0000000 0000000 00000001542 12624061460 0034317 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation #
# 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=clean test
invoker.buildResult = success
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/pom.xml 0000664 0000000 0000000 00000002276 12624061460 0032125 0 ustar 00root root 0000000 0000000 4.0.0org.codehaus.mojo.templating.itsimple1.0-specialversioncoquinouorg.apache.maven.pluginsmaven-compiler-plugin3.31.51.5org.codehaus.mojotemplating-maven-plugin@project.version@filter-sourcesjunitjunit4.11
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/ 0000775 0000000 0000000 00000000000 12624061460 0031370 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/ 0000775 0000000 0000000 00000000000 12624061460 0032314 5 ustar 00root root 0000000 0000000 java-templates/ 0000775 0000000 0000000 00000000000 12624061460 0035152 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main pkg/ 0000775 0000000 0000000 00000000000 12624061460 0035733 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates A.java 0000664 0000000 0000000 00000000317 12624061460 0036757 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates/pkg package pkg;
import org.junit.Ignore;
@Ignore("${someprop}")
public class A {
public static final String FILTER_A="${someprop}";
public static final String FILTER_B="@someprop@";
} B.java 0000664 0000000 0000000 00000000310 12624061460 0036751 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates/pkg package pkg;
import org.junit.Ignore;
@Ignore( "@someprop@")
public class B {
public static final String FILTER_A="${someprop}";
public static final String FILTER_B="@someprop@";
}
C.java 0000664 0000000 0000000 00000000234 12624061460 0036757 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates/pkg package pkg;
import org.junit.Ignore;
@Ignore(
"${someprop}" +
"@someprop@" +
"${someprop}@someprop@ @someprop@${someprop}"
)
public class C {
} SomeClass.java 0000664 0000000 0000000 00000000361 12624061460 0040467 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates/pkg package pkg;
import org.junit.Ignore;
/* some stupid doc
* basedir=${basedir}
*
* some new code
* et bim
*/
@Ignore("${someprop}")
public class SomeClass
{
public static final String VERSION = "<${project.version}>";
}
some/ 0000775 0000000 0000000 00000000000 12624061460 0036676 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates/pkg SomeOtherClass.java 0000664 0000000 0000000 00000000174 12624061460 0042436 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java-templates/pkg/some package pkg.some;
public class SomeOtherClass
{
public static final String POUET="${project.build.sourceEncoding}";
} templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java/ 0000775 0000000 0000000 00000000000 12624061460 0033235 5 ustar 00root root 0000000 0000000 net/ 0000775 0000000 0000000 00000000000 12624061460 0033744 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java batmat/ 0000775 0000000 0000000 00000000000 12624061460 0035214 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java/net maven/ 0000775 0000000 0000000 00000000000 12624061460 0036322 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java/net/batmat App.java 0000664 0000000 0000000 00000000762 12624061460 0037712 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/main/java/net/batmat/maven package net.batmat.maven;
import pkg.some.SomeOtherClass;
// That one is impossible to do using a .properties file
// which you load for example in a static code block.
// So this is the kind of use where it comes useful.
@SuppressWarnings("for some "+pkg.SomeClass.VERSION)
public class App
{
public static void main(String[] args )
{
System.out.println("Hello World!" + pkg.some.SomeOtherClass.POUET);
System.out.println("Version:" + pkg.SomeClass.VERSION);
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/test/ 0000775 0000000 0000000 00000000000 12624061460 0032347 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/test/java/ 0000775 0000000 0000000 00000000000 12624061460 0033270 5 ustar 00root root 0000000 0000000 net/ 0000775 0000000 0000000 00000000000 12624061460 0033777 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/test/java batmat/ 0000775 0000000 0000000 00000000000 12624061460 0035247 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/test/java/net maven/ 0000775 0000000 0000000 00000000000 12624061460 0036355 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/test/java/net/batmat AppTest.java 0000664 0000000 0000000 00000002361 12624061460 0040602 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/src/test/java/net/batmat/maven package net.batmat.maven;
import static org.junit.Assert.assertEquals;
import org.junit.Ignore;
import org.junit.Test;
public class AppTest
{
@Test
public void testApp()
{
assertEquals("<1.0-specialversion>", pkg.SomeClass.VERSION);
assertEquals("coquinou", pkg.SomeClass.class.getAnnotation(Ignore.class).value());
}
@Test
public void testA() throws Exception
{
assertEquals("coquinou", pkg.A.class.getAnnotation(Ignore.class).value());
assertEquals("coquinou", pkg.A.class.getDeclaredField("FILTER_A").get(null));
assertEquals("coquinou", pkg.A.class.getDeclaredField("FILTER_B").get(null));
}
@Test
public void testB() throws Exception
{
assertEquals("coquinou", pkg.B.class.getDeclaredField("FILTER_A").get(null));
assertEquals("coquinou", pkg.B.class.getDeclaredField("FILTER_B").get(null));
}
@Ignore("See MOJO-2012, not sure it will ever work. To be continued...")
@Test
public void testB_TwoArobases() throws Exception
{
assertEquals("coquinou", pkg.B.class.getAnnotation(Ignore.class).value());
}
@Test
public void testC() throws Exception
{
assertEquals("coquinoucoquinoucoquinoucoquinou coquinoucoquinou", pkg.C.class.getAnnotation(Ignore.class).value());
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main-annotation/verify.groovy 0000664 0000000 0000000 00000002064 12624061460 0033356 0 ustar 00root root 0000000 0000000 /*
* 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')
assert buildLog.exists()
assert buildLog.text.contains("BUILD SUCCESS")
assert new File(basedir, 'target').exists();
assert new File(basedir, 'target/generated-sources/java-templates').exists();
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/ 0000775 0000000 0000000 00000000000 12624061460 0026431 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/invoker.properties 0000664 0000000 0000000 00000001542 12624061460 0032226 0 ustar 00root root 0000000 0000000 #
# 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=clean test
invoker.buildResult = success
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/pom.xml 0000664 0000000 0000000 00000002176 12624061460 0027754 0 ustar 00root root 0000000 0000000 4.0.0org.codehaus.mojo.templating.itsimple1.0-specialversionorg.apache.maven.pluginsmaven-compiler-plugin3.31.51.5org.codehaus.mojotemplating-maven-plugin@project.version@filter-sourcesjunitjunit4.11
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/ 0000775 0000000 0000000 00000000000 12624061460 0027220 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/ 0000775 0000000 0000000 00000000000 12624061460 0030144 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java-templates/ 0000775 0000000 0000000 00000000000 12624061460 0033061 5 ustar 00root root 0000000 0000000 pkg/ 0000775 0000000 0000000 00000000000 12624061460 0033563 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java-templates SomeClass.java 0000664 0000000 0000000 00000000275 12624061460 0036323 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java-templates/pkg package pkg;
/* some stupid doc
* basedir=${basedir}
*
* some new code
* et bim
*/
public class SomeClass
{
public static final String VERSION = "<${project.version}>";
}
some/ 0000775 0000000 0000000 00000000000 12624061460 0034526 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java-templates/pkg SomeOtherClass.java 0000664 0000000 0000000 00000000174 12624061460 0040266 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java-templates/pkg/some package pkg.some;
public class SomeOtherClass
{
public static final String POUET="${project.build.sourceEncoding}";
} templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java/ 0000775 0000000 0000000 00000000000 12624061460 0031065 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java/net/ 0000775 0000000 0000000 00000000000 12624061460 0031653 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java/net/batmat/ 0000775 0000000 0000000 00000000000 12624061460 0033123 5 ustar 00root root 0000000 0000000 maven/ 0000775 0000000 0000000 00000000000 12624061460 0034152 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java/net/batmat App.java 0000664 0000000 0000000 00000000762 12624061460 0035542 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/main/java/net/batmat/maven package net.batmat.maven;
import pkg.some.SomeOtherClass;
// That one is impossible to do using a .properties file
// which you load for example in a static code block.
// So this is the kind of use where it comes useful.
@SuppressWarnings("for some "+pkg.SomeClass.VERSION)
public class App
{
public static void main(String[] args )
{
System.out.println("Hello World!" + pkg.some.SomeOtherClass.POUET);
System.out.println("Version:" + pkg.SomeClass.VERSION);
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/test/ 0000775 0000000 0000000 00000000000 12624061460 0030177 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/test/java/ 0000775 0000000 0000000 00000000000 12624061460 0031120 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/test/java/net/ 0000775 0000000 0000000 00000000000 12624061460 0031706 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/test/java/net/batmat/ 0000775 0000000 0000000 00000000000 12624061460 0033156 5 ustar 00root root 0000000 0000000 maven/ 0000775 0000000 0000000 00000000000 12624061460 0034205 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/test/java/net/batmat AppTest.java 0000664 0000000 0000000 00000000342 12624061460 0036427 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/src/test/java/net/batmat/maven package net.batmat.maven;
import org.junit.Assert;
public class AppTest
{
@org.junit.Test
public void testApp()
{
Assert.assertEquals( "<1.0-specialversion>", pkg.SomeClass.VERSION);
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-main/verify.groovy 0000664 0000000 0000000 00000002064 12624061460 0031206 0 ustar 00root root 0000000 0000000 /*
* 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')
assert buildLog.exists()
assert buildLog.text.contains("BUILD SUCCESS")
assert new File(basedir, 'target').exists();
assert new File(basedir, 'target/generated-sources/java-templates').exists();
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/ 0000775 0000000 0000000 00000000000 12624061460 0026647 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/invoker.properties 0000664 0000000 0000000 00000001542 12624061460 0032444 0 ustar 00root root 0000000 0000000 #
# 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=clean test
invoker.buildResult = success
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/pom.xml 0000664 0000000 0000000 00000002723 12624061460 0030170 0 ustar 00root root 0000000 0000000 4.0.0org.codehaus.mojo.templating.itsimple1.0-specialtestversionjunitjunit4.11testorg.apache.maven.pluginsmaven-compiler-plugin3.31.51.5org.codehaus.mojotemplating-maven-plugin@project.version@filter-sourcesfilter-test-sources#{*}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/ 0000775 0000000 0000000 00000000000 12624061460 0027436 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/ 0000775 0000000 0000000 00000000000 12624061460 0030362 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java-templates/ 0000775 0000000 0000000 00000000000 12624061460 0033277 5 ustar 00root root 0000000 0000000 pkg/ 0000775 0000000 0000000 00000000000 12624061460 0034001 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java-templates SomeClass.java 0000664 0000000 0000000 00000000277 12624061460 0036543 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java-templates/pkg package pkg;
/* some stupid doc
* basedir=${basedir}
*
* some new code
* et bim
*/
public class SomeClass
{
public static final String VERSION = "est ${project.version}";
}
some/ 0000775 0000000 0000000 00000000000 12624061460 0034744 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java-templates/pkg SomeOtherClass.java 0000664 0000000 0000000 00000000174 12624061460 0040504 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java-templates/pkg/some package pkg.some;
public class SomeOtherClass
{
public static final String POUET="${project.build.sourceEncoding}";
} templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java/ 0000775 0000000 0000000 00000000000 12624061460 0031303 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java/net/ 0000775 0000000 0000000 00000000000 12624061460 0032071 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java/net/batmat/ 0000775 0000000 0000000 00000000000 12624061460 0033341 5 ustar 00root root 0000000 0000000 maven/ 0000775 0000000 0000000 00000000000 12624061460 0034370 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java/net/batmat App.java 0000664 0000000 0000000 00000000762 12624061460 0035760 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/main/java/net/batmat/maven package net.batmat.maven;
import pkg.some.SomeOtherClass;
// That one is impossible to do using a .properties file
// which you load for example in a static code block.
// So this is the kind of use where it comes useful.
@SuppressWarnings("for some "+pkg.SomeClass.VERSION)
public class App
{
public static void main(String[] args )
{
System.out.println("Hello World!" + pkg.some.SomeOtherClass.POUET);
System.out.println("Version:" + pkg.SomeClass.VERSION);
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/ 0000775 0000000 0000000 00000000000 12624061460 0030415 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java-templates/ 0000775 0000000 0000000 00000000000 12624061460 0033332 5 ustar 00root root 0000000 0000000 net/ 0000775 0000000 0000000 00000000000 12624061460 0034041 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java-templates batmat/ 0000775 0000000 0000000 00000000000 12624061460 0035311 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java-templates/net maven/ 0000775 0000000 0000000 00000000000 12624061460 0036417 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java-templates/net/batmat SomeTestClass.java 0000664 0000000 0000000 00000000316 12624061460 0042013 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java-templates/net/batmat/maven package net.batmat.maven;
/* some stupid doc
* basedir=${basedir}
*
* some new code
* et bim
*/
public class SomeTestClass
{
public static final String VERSION = "%${project.version}%";
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java/ 0000775 0000000 0000000 00000000000 12624061460 0031336 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java/some/ 0000775 0000000 0000000 00000000000 12624061460 0032301 5 ustar 00root root 0000000 0000000 testpkg/ 0000775 0000000 0000000 00000000000 12624061460 0033703 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java/some TheClass.java 0000664 0000000 0000000 00000000461 12624061460 0036255 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/src/test/java/some/testpkg package some.testpkg;
import org.junit.Assert;
import org.junit.Test;
@SuppressWarnings( net.batmat.maven.SomeTestClass.VERSION )
public class TheClass
{
@Test
public void testFoo()
{
Assert.assertEquals( "%1.0-specialtestversion%", net.batmat.maven.SomeTestClass.VERSION );
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/filter-tests/verify.groovy 0000664 0000000 0000000 00000002210 12624061460 0031415 0 ustar 00root root 0000000 0000000 /*
* 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')
assert buildLog.exists()
assert buildLog.text.contains("BUILD SUCCESS")
assert new File(basedir, 'target').exists();
assert new File(basedir, 'target/generated-sources/java-templates').exists();
assert new File(basedir, 'target/generated-test-sources/java-templates').exists();
templating-maven-plugin-templating-maven-plugin-1.0.0/src/it/settings.xml 0000664 0000000 0000000 00000004352 12624061460 0026610 0 ustar 00root root 0000000 0000000
my.serverme{iFtD2TFFjzoHEDN1RxW21zEBYW0Gt7GwbsOm6yDS63s=}it-repotruelocal.central@localRepositoryUrl@truetrueapache.snapshotsApache Snapshot Repositoryhttp://people.apache.org/repo/m2-snapshot-repositoryfalsetruelocal.central@localRepositoryUrl@truetrue
templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/ 0000775 0000000 0000000 00000000000 12624061460 0024532 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/ 0000775 0000000 0000000 00000000000 12624061460 0025453 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/ 0000775 0000000 0000000 00000000000 12624061460 0026242 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/codehaus/ 0000775 0000000 0000000 00000000000 12624061460 0030035 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/codehaus/mojo/ 0000775 0000000 0000000 00000000000 12624061460 0031001 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/codehaus/mojo/templating/ 0000775 0000000 0000000 00000000000 12624061460 0033145 5 ustar 00root root 0000000 0000000 AbstractFilterSourcesMojo.java 0000664 0000000 0000000 00000036752 12624061460 0041050 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/codehaus/mojo/templating package org.codehaus.mojo.templating;
/*
* 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 java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.zip.CRC32;
import org.apache.maven.execution.MavenSession;
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.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.MavenResourcesExecution;
import org.apache.maven.shared.filtering.MavenResourcesFiltering;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.plexus.build.incremental.BuildContext;
/**
* The base class for {@link FilterSourcesMojo} and {@link FilterTestSourcesMojo}
*/
public abstract class AbstractFilterSourcesMojo
extends AbstractMojo
{
private static final int CHECKSUM_BUFFER = 4096;
private int copied = 0;
/**
* @return The location of the source directory.
*/
protected abstract File getSourceDirectory();
/**
* @return The location of the output directory.
*/
protected abstract File getOutputDirectory();
@Component
private BuildContext buildContext;
/**
* The character encoding scheme to be applied when filtering resources.
*/
@Parameter( defaultValue = "${project.build.sourceEncoding}" )
private String encoding;
/**
* Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}
*/
@Parameter( property = "maven.resources.escapeString" )
protected String escapeString;
/**
* Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form
* 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end. So, the
* default filtering delimiters might be specified as:
*
*
*
* Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).
*/
@Parameter
protected List delimiters;
/**
* Controls whether the default delimiters are included in addition to those configured {@link #delimiters}. Does
* not have any effect if {@link #delimiters} is empty when the defaults will be included anyway.
*/
@Parameter( defaultValue = "true" )
protected boolean useDefaultDelimiters;
@Parameter( defaultValue = "${session}", required = true, readonly = true )
private MavenSession session;
@Parameter( defaultValue = "${project}", required = true, readonly = true )
private MavenProject project;
/**
* Controls whether to overwrite files that are not changed, by default files will not be overwritten
*/
@Parameter( defaultValue = "false" )
protected boolean overwrite;
/**
* Skips POM projects if set to true, which is the default option.
*/
@Parameter( defaultValue = "true" )
protected boolean skipPoms;
/**
* The resources filtering which is used.
*/
@Component( hint = "default" )
protected MavenResourcesFiltering mavenResourcesFiltering;
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException
{
File sourceDirectory = getSourceDirectory();
if ( !preconditionsFulfilled( sourceDirectory ) )
{
return;
}
buildContext.removeMessages( sourceDirectory );
// 1 Copy with filtering the given source to temporary dir
copied = 0;
File temporaryDirectory = getTemporaryDirectory( sourceDirectory );
logInfo( "Coping files with filtering to temporary directory." );
logDebug( "Temporary director for filtering is: %s", temporaryDirectory );
filterSourceToTemporaryDir( sourceDirectory, temporaryDirectory );
// 2 Copy if needed
copyDirectoryStructure( temporaryDirectory, getOutputDirectory() );
cleanupTemporaryDirectory( temporaryDirectory );
if ( isSomethingBeenUpdated() )
{
buildContext.refresh( getOutputDirectory() );
logInfo( "Copied %d files to output directory: %s", copied, getOutputDirectory() );
}
else
{
logInfo( "No files needs to be copied to output directory. Up to date: %s", getOutputDirectory() );
}
// 3 Add that dir to sources
addSourceFolderToProject( this.project );
logInfo( "Source directory: %s added.", getOutputDirectory() );
}
/**
* @return number of copied files.
*/
protected int countCopiedFiles()
{
return copied;
}
private void logInfo( String format, Object... args )
{
if ( getLog().isInfoEnabled() )
{
getLog().info( String.format( format, args ) );
}
}
private void logDebug( String format, Object... args )
{
if ( getLog().isDebugEnabled() )
{
getLog().debug( String.format( format, args ) );
}
}
private boolean isSomethingBeenUpdated()
{
return copied > 0;
}
private void cleanupTemporaryDirectory( File temporaryDirectory )
throws MojoExecutionException
{
try
{
FileUtils.forceDelete( temporaryDirectory );
}
catch ( IOException ex )
{
throw new MojoExecutionException( ex.getMessage(), ex );
}
}
private void filterSourceToTemporaryDir( final File sourceDirectory, final File temporaryDirectory )
throws MojoExecutionException
{
List resources = new ArrayList();
Resource resource = new Resource();
resource.setFiltering( true );
logDebug( "Source absolute path: %s", sourceDirectory.getAbsolutePath() );
resource.setDirectory( sourceDirectory.getAbsolutePath() );
resources.add( resource );
MavenResourcesExecution mavenResourcesExecution =
new MavenResourcesExecution( resources, temporaryDirectory, project, encoding,
Collections.emptyList(), Collections.emptyList(), session );
mavenResourcesExecution.setInjectProjectBuildFilters( true );
mavenResourcesExecution.setEscapeString( escapeString );
mavenResourcesExecution.setOverwrite( overwrite );
setDelimitersForExecution( mavenResourcesExecution );
try
{
mavenResourcesFiltering.filterResources( mavenResourcesExecution );
}
catch ( MavenFilteringException e )
{
buildContext.addMessage( getSourceDirectory(), 1, 1, "Filtering Exception", BuildContext.SEVERITY_ERROR,
e );
throw new MojoExecutionException( e.getMessage(), e );
}
}
private void setDelimitersForExecution( MavenResourcesExecution mavenResourcesExecution )
{
// if these are NOT set, just use the defaults, which are '${*}' and '@'.
if ( delimiters != null && !delimiters.isEmpty() )
{
LinkedHashSet delims = new LinkedHashSet();
if ( useDefaultDelimiters )
{
delims.addAll( mavenResourcesExecution.getDelimiters() );
}
for ( String delim : delimiters )
{
if ( delim == null )
{
// FIXME: ${filter:*} could also trigger this condition. Need a better long-term solution.
delims.add( "${*}" );
}
else
{
delims.add( delim );
}
}
mavenResourcesExecution.setDelimiters( delims );
}
}
private void preconditionsCopyDirectoryStructure( final File sourceDirectory, final File destinationDirectory,
final File rootDestinationDirectory )
throws IOException
{
if ( sourceDirectory == null )
{
throw new IOException( "source directory can't be null." );
}
if ( destinationDirectory == null )
{
throw new IOException( "destination directory can't be null." );
}
if ( sourceDirectory.equals( destinationDirectory ) )
{
throw new IOException( "source and destination are the same directory." );
}
if ( !sourceDirectory.exists() )
{
throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." );
}
}
private void copyDirectoryStructure( final File sourceDirectory, final File destinationDirectory )
throws MojoExecutionException
{
try
{
File target = destinationDirectory;
if ( !target.isAbsolute() )
{
target = resolve( project.getBasedir(), destinationDirectory.getPath() );
}
copyDirectoryStructureWithIO( sourceDirectory, target, target );
}
catch ( IOException ex )
{
throw new MojoExecutionException( ex.getMessage(), ex );
}
}
private void copyDirectoryStructureWithIO( final File sourceDirectory, final File destinationDirectory,
final File rootDestinationDirectory )
throws IOException
{
preconditionsCopyDirectoryStructure( sourceDirectory, destinationDirectory, rootDestinationDirectory );
File[] files = sourceDirectory.listFiles();
if ( files == null )
{
return;
}
String sourcePath = sourceDirectory.getAbsolutePath();
for ( File file : files )
{
if ( file.equals( rootDestinationDirectory ) )
{
// We don't copy the destination directory in itself
continue;
}
String dest = file.getAbsolutePath();
dest = dest.substring( sourcePath.length() + 1 );
File destination = new File( destinationDirectory, dest );
if ( file.isFile() )
{
destination = destination.getParentFile();
if ( isFileDifferent( file, destination ) )
{
copied++;
FileUtils.copyFileToDirectory( file, destination );
}
}
else if ( file.isDirectory() )
{
if ( !destination.exists() && !destination.mkdirs() )
{
throw new IOException( "Could not create destination directory '" + destination.getAbsolutePath()
+ "'." );
}
copyDirectoryStructureWithIO( file, destination, rootDestinationDirectory );
}
else
{
throw new IOException( "Unknown file type: " + file.getAbsolutePath() );
}
}
}
private File resolve( final File file, final String... subfile )
{
StringBuilder path = new StringBuilder();
path.append( file.getPath() );
for ( String fi : subfile )
{
path.append( File.separator );
path.append( fi );
}
return new File( path.toString() );
}
private boolean isFileDifferent( final File file, final File directory )
throws IOException
{
File targetFile = resolve( directory, file.getName() ).getAbsoluteFile();
return !targetFile.canRead() || getCrc32OfFile( file ) != getCrc32OfFile( targetFile );
}
private long getCrc32OfFile( final File target )
throws IOException
{
FileInputStream fis = null;
try
{
fis = new FileInputStream( target );
CRC32 crcMaker = new CRC32();
byte[] buffer = new byte[CHECKSUM_BUFFER];
int bytesRead;
while ( ( bytesRead = fis.read( buffer ) ) != -1 )
{
crcMaker.update( buffer, 0, bytesRead );
}
return crcMaker.getValue();
}
catch ( FileNotFoundException ex )
{
close( fis );
throw new IOException( ex.getLocalizedMessage(), ex );
}
finally
{
close( fis );
}
}
private void close( Closeable is )
throws IOException
{
if ( is != null )
{
is.close();
}
}
private File getTemporaryDirectory( File sourceDirectory )
throws MojoExecutionException
{
File basedir = project.getBasedir();
File target = new File( project.getBuild().getDirectory() );
StringBuilder label = new StringBuilder( "templates-tmp" );
CRC32 crcMaker = new CRC32();
crcMaker.update( sourceDirectory.getPath().getBytes() );
label.append( crcMaker.getValue() );
String subfile = label.toString();
return target.isAbsolute() ? resolve( target, subfile ) : resolve( basedir, target.getPath(), subfile );
}
private boolean preconditionsFulfilled( File sourceDirectory )
{
if ( skipPoms && "pom".equals( project.getPackaging() ) )
{
logInfo( "Skipping a POM project type. Change a `skipPoms` to false to run anyway." );
return false;
}
logDebug( "source=%s target=%s", sourceDirectory, getOutputDirectory() );
if ( !( sourceDirectory != null && sourceDirectory.exists() ) )
{
logInfo( "Request to add '%s' folder. Not added since it does not exist.", sourceDirectory );
return false;
}
return true;
}
/**
* @param mavenProject {@link MavenProject}
*/
protected abstract void addSourceFolderToProject( MavenProject mavenProject );
}
FilterSourcesMojo.java 0000664 0000000 0000000 00000004462 12624061460 0037355 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/codehaus/mojo/templating package org.codehaus.mojo.templating;
/*
* 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 java.io.File;
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.project.MavenProject;
/**
* This mojo helps adding a filtered source folder in one go. This is typically useful if you want to use properties
* coming from the POM inside parts of your source code that requires real constants, like annotations for example.
*/
@Mojo( name = "filter-sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
public class FilterSourcesMojo
extends AbstractFilterSourcesMojo
{
/**
* Source directory that will be first filtered and then added as a classical source folder.
*/
@Parameter( defaultValue = "${basedir}/src/main/java-templates" )
File sourceDirectory;
/**
* Output folder where filtered sources will land.
*/
@Parameter( defaultValue = "${project.build.directory}/generated-sources/java-templates" )
private File outputDirectory;
@Override
protected File getSourceDirectory()
{
return sourceDirectory;
}
@Override
protected File getOutputDirectory()
{
return outputDirectory;
}
@Override
protected void addSourceFolderToProject( MavenProject mavenProject )
{
mavenProject.addCompileSourceRoot( getOutputDirectory().getAbsolutePath() );
}
}
FilterTestSourcesMojo.java 0000664 0000000 0000000 00000004553 12624061460 0040216 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/java/org/codehaus/mojo/templating package org.codehaus.mojo.templating;
/*
* 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 java.io.File;
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.project.MavenProject;
/**
* This mojo helps adding a filtered source folder in one go. This is typically useful if you want to use properties
* coming from the POM inside parts of your test source code that requires real constants, like annotations for example.
*/
@Mojo( name = "filter-test-sources", defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES, threadSafe = true )
public class FilterTestSourcesMojo
extends AbstractFilterSourcesMojo
{
/**
* Source directory that will be first filtered and then added as a classical source folder.
*/
@Parameter( defaultValue = "${basedir}/src/test/java-templates" )
private File testSourceDirectory;
/**
* Output folder where filtered test sources will land.
*/
@Parameter( defaultValue = "${project.build.directory}/generated-test-sources/java-templates" )
private File testOutputDirectory;
@Override
protected File getSourceDirectory()
{
return testSourceDirectory;
}
@Override
protected File getOutputDirectory()
{
return testOutputDirectory;
}
@Override
protected void addSourceFolderToProject( MavenProject mavenProject )
{
mavenProject.addTestCompileSourceRoot( getOutputDirectory().getAbsolutePath() );
}
}
templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/resources/ 0000775 0000000 0000000 00000000000 12624061460 0026544 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/resources/META-INF/ 0000775 0000000 0000000 00000000000 12624061460 0027704 5 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/resources/META-INF/m2e/ 0000775 0000000 0000000 00000000000 12624061460 0030367 5 ustar 00root root 0000000 0000000 lifecycle-mapping-metadata.xml 0000664 0000000 0000000 00000001024 12624061460 0036175 0 ustar 00root root 0000000 0000000 templating-maven-plugin-templating-maven-plugin-1.0.0/src/main/resources/META-INF/m2e
filter-sourcesfilter-test-sourcestruetrue