Commit Graph

440 Commits

Author SHA1 Message Date
Phillip Webb
ba7c1fda72 Convert Gradle plugin from Groovy to Java
Replace existing Groovy code with Java since the Groovy Eclipse tooling
currently forces the use of an old jdt plugin which has formatter bugs.

Fixes gh-4113
2015-10-07 23:12:25 -07:00
Spring Buildmaster
9409c49c10 Next development version 2015-09-16 09:00:17 -07:00
Phillip Webb
15686ed4fd Reformat code 2015-09-08 14:07:06 -07:00
Phillip Webb
0f6b60d8c8 Organize imports 2015-09-08 14:05:00 -07:00
Stephane Nicoll
1ee31e73d3 Avoid NPE if @ConfigurationProperties is not present
The annotation processor detects `@ConfigurationProperties` bean or
method definition and merges manual meta-data. The former step will fail
with a NPE if the annotation is not present on the classpath. This could
happen if the annotation processor is added to a module that is not
actually using Spring Boot.

We now have a defensive check that skips that steps but still attempts to
merge manual meta-data if present.

Closes gh-3720
2015-08-10 16:34:30 +02:00
Andy Wilkinson
d241171fff Use fast exceptions in hasMoreElements in LaunchedURLClassLoader
When nested jars are being used, hasMoreElements requires opening a
connection for an entry in every nested jar. If that entry doesn't
exist, a FileNotFoundException is thrown to indicate that a particular
jar doesn't contain the requested entry. This exception is used to
indicate the lack of an entry and is then swallowed, i.e. its stack
trace is of no importance. This means that the performance of
hasMoreElements can be improved by switching on fast exceptions while
it's being called. When fast exceptions are switched on a general
purpose pre-initialized FileNotFoundException is thrown rather than
creating a new FileNotFoundException instance each time.

In certain situations, the use of fast exceptions as described above
can improve performance fairly significantly. The JRE's default SAAJ
implementation uses META-INF/services-based discovery for _every_
request that's handled by Spring Web Services. Each discovery attempt
results in hasMoreElements being called making its performance
critical to throughput.

See gh-3640
2015-08-03 15:39:56 +01:00
Stephane Nicoll
057824aca7 Fix maven plugin configuration
Closes gh-3601
2015-07-27 08:18:09 +02:00
Phillip Webb
4b17f3ceef Formatting 2015-07-09 10:37:21 -07:00
Andy Wilkinson
68e54e1d5d Favour entries in source jar over standard libraries when repackaging
When writing a jar, once an entry has been written it will never be
overwritten, i.e. the first write of a given entry will win. Previously,
when repackaging a jar, the existing contents were written followed by
any libraries. This caused a problem when repackaged a WAR file and
a library needed to be unpacked as the existing entry in WEB-INF/lib
would prevent the library with the UNPACK comment from being written.
This was addressed in f761916b by inverting the order so libraries
would take precedence over entries in the source jar.

It’s now become apparent that this change in the order causes a problem
for users who are obfuscating their code. The obfuscated code exists in
the source jar but is also provided to the repackager in its original
form as a library. When libraries take precedence, this means that the
code in its original form ends up in the repackaged war and the
obfuscation is lost.

This commit updates the repackager to write libraries that require
unpacking first. This allows the UNPACK comment to be written even if
there’s also a source entry for the library. Next, source entries are
written. This allows obfuscated source entries to take precedence over
any unobfuscated library equivalents. Lastly, standard libraries that
do not require unpacking are written into the repackaged archive.

Closes gh-3444
2015-07-09 16:37:10 +01:00
Spring Buildmaster
7ce391db4f Next development version 2015-07-01 22:48:01 -07:00
Phillip Webb
a1b87766a7 Fix PropertiesLauncher javadoc
See gh-3392
2015-07-01 18:09:56 -07:00
Phillip Webb
135e9d10a6 Polish 2015-06-15 10:52:02 -07:00
Lugi Cardito
a37e983296 Create output directory if necessary
If the `repackage` goal defines an output directory that does not exist,
the maven plugin now creates it.

Closes gh-3136
2015-06-10 10:27:53 +02:00
Spring Buildmaster
5d81c87b43 Next Development Version 2015-06-04 00:49:11 -07:00
Phillip Webb
968b68c322 Polish 2015-06-02 11:17:16 -07:00
Stephane Nicoll
f25ce8a381 Fix artifact extension retrieval
Do not rely on the packaging type to figure out what the extension of the
main artifact will be. So far, using `jar` and `war` packaging for `.jar`
and `.war` files worked by chance.

We know retrieve the actual extension as provided by Maven's
`ArtifactHandler`.

Fixes gh-2762
2015-05-26 16:21:00 +02:00
Andy Wilkinson
ebb8d0c55f Read the time of a JarEntryData using MSDOS Date Time format
The format is rather unusual.

The time is 16 bits: 5 bits for the hour, 6 bits for the minutes, and 5
bits for the seconds. 5 bits only allows 32 values (0-31) so the number
must be doubled, meaning that the time is only accurate to the nearest
two seconds. Also, the JDK rounds this down by subtracting one. The
doubling and rounding is performed by shifting one place to the left
and masking off the right-most bit respectively.

The date is 16 bits: 7 bits for the year, 4 bits for the month, and 5
bits for the day. The year is from 1980, i.e. the earliest date that
can be represented is 1980-01-01.

See http://mindprod.com/jgloss/zip.html for more details of the format.

Fixes gh-2826
2015-04-15 17:03:06 +01:00
Spring Buildmaster
e03c11dda8 Next development version 2015-03-30 22:56:20 -07:00
Andy Wilkinson
c3a040acb3 Polishing
Remove unwanted System.out.println call
2015-03-26 10:00:35 +00:00
Andy Wilkinson
f761916b51 Honor unpack for war files
Previously repackaging of an archive was performed in three steps:

1. Write the manifest
2. Write entries from the source archive into the destination
3. Write any libraries into the destination if they’re not already there

This worked fine for jar files, but not for war files. In the war file
case the libraries are already in the source archive’s WEB-INF/lib
directory so they’re copied into the destination in step 2. This means
that step 3 largely becomes a no-op and, crucially, the UNPACK comment
is not applied to any libraries that require it.

This commit reorders steps 2 and 3 so that the libraries are copied into
the destination first (allowing the UNPACK comment to be written, if
required) and then any entries in the source are written into the
destination if they’re not already there.

Fixes gh-2588
2015-03-04 13:42:50 +00:00
Phillip Webb
0174476ff1 Merge branch '1.1.x' into 1.2.x 2015-03-02 12:12:57 -08:00
Phillip Webb
50e1f80581 Remove .factorypath files 2015-03-02 12:12:06 -08:00
Phillip Webb
561ed99b5b Merge branch '1.1.x' into 1.2.x 2015-03-02 12:09:24 -08:00
Spring Buildmaster
8f0ad02237 Next development version 2015-02-26 15:26:53 -08:00
Phillip Webb
8a49218e82 Fixup version numbers following release 2015-02-26 14:17:25 -08:00
Spring Buildmaster
aea68f0c32 Next development version 2015-02-26 13:01:31 -08:00
Phillip Webb
56e31a8c6b Polish 2015-02-23 19:21:37 -08:00
Phillip Webb
1f0d45d795 Protect against NPE and improve error message
Update ConfigurationMetadataAnnotationProcessor so that `prefix` is
only obtained when the annotation is not null. Also improve exception
message by including the element.
2015-02-23 18:28:23 -08:00
Stephane Nicoll
f8b191ff56 Revert "Add Version and VersionRange utilities"
This reverts commit 34ede2f31f.
2015-02-18 18:26:35 +01:00
Stephane Nicoll
34ede2f31f Add Version and VersionRange utilities
Parse a version using our version format or any version that complies
with Major.Minor.Patch. Also add a VersionRange utility that can
determine if a given version is withing that range.

Closes gh-2494
2015-02-16 18:34:26 +01:00
Stephane Nicoll
e8e39e4bcf polish 2015-02-13 14:56:13 +01:00
Phillip Webb
636898f9ad Polish 2015-02-09 11:39:48 -08:00
Phillip Webb
8e398dc6a7 Polish Javadoc
Update Javadoc to add missing @return and @param elements.
2015-02-03 11:35:06 -08:00
Andy Wilkinson
a88f27168a Add support to the Gradle plugin for disabling direct use of resources
The Maven plugin allows spring-boot:run to be configured so that
resources are loaded from their output location rather than from
src/main/resources. This commit adds an equivalent configuration
option to the Gradle plugin. To disable source resources from being
added to the classpath in place of those in the output location
the configure the bootRun tasks like this:

bootRun {
	addResources = false
}

Closes gh-2431
2015-02-03 10:52:10 +00:00
Phillip Webb
0696695e16 Add package javadoc 2015-02-02 17:05:38 -08:00
Phillip Webb
ccdbfd274f Fix Java 8 Javadoc compatibility
Update Javadocs to fix errors caused by Java 8 aggressive linting.

Fixes gh-2233
2015-02-02 17:05:37 -08:00
Phillip Webb
072f873f34 Polish 2015-02-01 21:37:17 -08:00
Phillip Webb
3328c1369f Merge branch '1.1.x'
Conflicts:
	spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
2015-02-01 20:28:11 -08:00
Phillip Webb
555827cad7 Polish 2015-02-01 20:00:11 -08:00
Andy Wilkinson
23c175f674 Polish metadata annotation processor’s incremental build support
The main change in this commit is to introduce a new BuildHandler
abstraction. A BuildHandler is responsible for producing the metadata
for a build. Two implementations are provided; one for standard builds
and one for incremental builds. This change means that the annotation
processor is no longer concerned with the two different build types
and can use the same logic in each case.

The code for reading and writing metadata files has also been moved
out into a separate class, MetadataStore, to allow it to be easily
utilised from multiple places.

Closes gh-2313
2015-01-28 15:27:45 +00:00
Kris De Volder
8df43a8a79 Update the metadata annotation processor to support incremental builds
This commit udpdates the metadata annotation processor so that change
data from an incremental build is merged with the metadata from the
previous build.

Closes gh-2321
2015-01-28 15:26:02 +00:00
Andy Wilkinson
528a632fd1 Allow XA DataSource and ConnFactory pools to be configured via the env
This commit adds support for configuring the XA DataSource and
ConnectionFactory pools created by Atomikos and Bitronix via the
environment. The property prefixes vary depending on the transaction
manager that’s in use. They are:

Bitronix:
 - spring.jta.bitronix.datasource
 - spring.jta.bitronix.connectionfactory

Atomikos:
 - spring.jta.atomikos.datasource
 - spring.jta.atomikos.connectionfactory

The configuration processor has been updated to ignore
javax.jms.XAConnectionFactory and javax.sql.XADataSource as neither of
these types can be created via property binding.

Closes gh-2027
2015-01-27 10:55:56 +00:00
Andy Wilkinson
2665ef0692 Merge branch '1.1.x' 2015-01-21 15:09:27 +00:00
Andy Wilkinson
93b2a17fb8 Make repackage depend on jar tasks from runtime project dependencies
By default, when building a project's jar its runtime dependencies
are not taken into account as they are not needed to successfully
compile the code that will be packaged in the jar. A side-effect of
this was that, if a project that was being repackaged had a runtime
dependency on another project, then the repackaged jar would not
include the jar of the project on which it has the runtime dependency
as the jar had not been built.

This commit updates Boot's repackage task to have a dependency on the
jar task of any project dependencies in the runtime configuration
thereby ensuring that those dependencies' jars will have been built
before the repackaging occurs.

Fixes gh-2344
2015-01-21 15:02:10 +00:00
Andy Wilkinson
ca69156afd Merge branch '1.1.x' 2015-01-21 13:20:06 +00:00
Andy Wilkinson
bbd2486c04 Run invoker plugin with a single thread to avoid build failures
Running the invoker plugin with multiple threads against an empty
Maven cache results in strange build failures where Maven claims that
it cannot find a jar or pom file for an artifact that it should be
able to find. It would appear that Maven is unable to cope with
concurrent writes to its cache.

This commit removes the usage of multiple threads that was introduced
in 4e907f1.

Fixes gh-2389
2015-01-21 13:19:52 +00:00
Andy Wilkinson
606ea4979a Add a test to cover the merging of an additional metadata file
This test covers the code path that caused gh-2361 and also checks that,
when an additional metadata file is found, it’s correctly merged with
the other metadata.

Closes gh-2361
2015-01-21 11:18:32 +00:00
Kris De Volder
65acaf885b Remove incorrect assumption that output will be in folder named classes
When running in Eclipse, by default Gradle builds its output into a
folder named bin. This commit update the annotation processor to remove
the failure assumption that the output will always be located beneath
a folder named classes.

Closes gh-2369
See gh-2361
2015-01-21 11:16:56 +00:00
Dave Syer
1be12ee945 Merge branch '1.1.x' 2015-01-20 17:38:31 +00:00
Dave Syer
4e907f19ce Carefully add nested archives from JAR in PropertiesLauncher
If user runs an executable archive then it and its lib directory will be
on the classpath. Entries from loader.path take precedence in a way that
should make sense to users (earlier wins like in CLASSPATH env var).

Also added new integration tests to verify the behaviour (big improvement
on the old ones, which probably aought to be beefed up to the same
standard).

Fixes gh-2314
2015-01-20 17:37:49 +00:00