Skip to content

#14729 - Corrupt Jar & War Files #14745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
May 17, 2025
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
76258eb
disable bootJar / bootArchive since no valid application class exists…
jdaugherty May 15, 2025
2840260
tasks use an isolated classpath so groovy has to be provided
jdaugherty May 15, 2025
e676573
update find main class task and strictly validate the existence
jdaugherty May 15, 2025
d81908d
remove old grails-plugin file since the name matches the generated na…
jdaugherty May 15, 2025
a7afb88
Remove duplicate files now that AST transforms are properly generatin…
jdaugherty May 15, 2025
3e93a26
Enhance error message to determine which plugin is a problem
jdaugherty May 15, 2025
10220b5
Update tests for deprecated class removal
jdaugherty May 15, 2025
275654c
remove entries that have been added to the grails-doc
jdaugherty May 15, 2025
f48b76a
add codec move to grails doc
jdaugherty May 15, 2025
dd1a96d
remove buildscript since buildSrc exists
jdaugherty May 16, 2025
88f123e
Remove remaining pathing jar code
jdaugherty May 16, 2025
8a4414b
Various api cleanup for update to java 17
jdaugherty May 16, 2025
c5e4693
Add helper repo for debugging grails-bom locally in test apps
jdaugherty May 16, 2025
7e130b6
Fix nested directory copy
jdaugherty May 16, 2025
03ac9b2
Switch back to 3.4.3 until spring framework 6.2.7 is released
jdaugherty May 16, 2025
ce686fe
fix class.getClass() call
jdaugherty May 16, 2025
7f68731
do not fail on find main class if the project is a grails plugin
jdaugherty May 16, 2025
ef1bfc6
Revert "Various api cleanup for update to java 17"
jdaugherty May 16, 2025
8f68c88
Merge branch '7.0.x' into corrupt-jar-fixes
jdaugherty May 16, 2025
3105623
remove SDKMAN workflow since forge will always publish
jdaugherty May 16, 2025
7241f65
Remove the doc method that's been deprecated since Grails 1
jdaugherty May 16, 2025
faf6c12
Merge branch '7.0.x' into corrupt-jar-fixes
jamesfredley May 16, 2025
25d0c1d
Merge branch '7.0.x' into corrupt-jar-fixes
jamesfredley May 16, 2025
00e5a7b
feedback - remove commented code
jdaugherty May 16, 2025
9da8344
feedback - update warning message wording
jdaugherty May 16, 2025
a121b8f
feedback - revert license header changes
jdaugherty May 17, 2025
745f5d5
Add license header template to ensure consistent copyright updates in…
jdaugherty May 17, 2025
26732d7
feedback - update comment
jdaugherty May 17, 2025
649f1b4
feedback - styling & grammar corrections
jdaugherty May 17, 2025
562c070
add favicon mapping to avoid 500 errors
jdaugherty May 17, 2025
1975eab
to avoid confusion, use a custom error message
jdaugherty May 17, 2025
2c5701b
Add commented out debugging args for when needed
jdaugherty May 17, 2025
d760235
Merge branch '7.0.x' into corrupt-jar-fixes
jdaugherty May 17, 2025
d4da849
Merge branch '7.0.x' into corrupt-jar-fixes
jdaugherty May 17, 2025
9ec8a49
Merge branch '7.0.x' into corrupt-jar-fixes
jdaugherty May 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions .github/workflows/sdkman.yml

This file was deleted.

36 changes: 2 additions & 34 deletions UPGRADE7.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,12 @@ limitations under the License.
# Common 7.0 Upgrade Gotchas - DRAFT -

Experienced while upgrading modules for Grails 7
- the following deprecated classes were removed, please use the suggested replacement
* grails.core.GrailsTagLibClass -> grails.core.gsp.GrailsTagLibClass
* org.grails.core.artefact.TagLibArtefactHandler -> org.grails.core.artefact.gsp.TagLibArtefactHandler
* org.grails.core.DefaultGrailsTagLibClass -> org.grails.core.gsp.DefaultGrailsTagLibClass
- h2 2.x is stricter about reserved words
- https://github.com/apache/gorm-hibernate5/pull/910/commits/c8de45df204966ccc228b46b94beeb2142ae0f59
- [GROOVY-10621](https://issues.apache.org/jira/browse/GROOVY-10621)
- Primitive booleans will no longer generate the form of isProperty & getProperty. They will only generate isProperty()

- NOTE: Several items have been directly integrated into the upgrade guide. Please refer there for the full list.
- The amount of boilerplate required in gradle files has been reduced:
- When `org.grails.grails-plugin` gradle plugin is applied, the bootJar task is disabled by default. No more needing to explicitly set it to false!
- We no longer have a `micronaut-bom` and a `spring-bom`. We only have the `spring-bom` now, which allows `grails-bom` to inherit from it and be applied as part of the Spring Dependency Management plugin. This means versions do not need included for any library in the bom. Override bom versions via gradle properties.
- The `grailsPublish` plugin returns and is no longer an internal only plugin. It has been enhanced to work with some multi-project workflows. Eliminate publishing boilerplate of the nexus-publish, maven-publish, & signing plugin by adopting it.
- Jar artifacts produced by Grails Plugins will no longer have the suffix `-plain`
- https://github.com/apache/grails-gradle-plugin/pull/347
- [GROOVY-5169](https://issues.apache.org/jira/browse/GROOVY-5169) [GROOVY-10449](https://issues.apache.org/jira/browse/GROOVY-10449)
- Fields with a public modifier were not returned with MetaClassImpl#getProperties() in groovy 3, but are now.
- Some older libraries may include an older version of groovy, but still be compatible with Groovy 4. One example is `GPars`. In your gradle file, you can force a dependency upgrade via this code:

configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.codehaus.groovy') {
details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: '4.0.25')
}
}
}
- The `jakarta` package switch means that older libraries using `javax` will need to be updated to use the correct namespace. The side effect of this change is most grails plugins will likely need updated to be compatible with Grails 7.
- When migrating a new project to Grails 7, it's advised to generate a stock 7.0 app from [start.grails.org](https://start.grails.org) and compare the project with a grails app generated from the same grails version that your application uses. This helps catch the dependency clean up that has occurred. Including the additions of new dependencies. Note: due to an issue with project resolution the `grails-bom` will need explicitly imported in buildSrc or any project that does not apply the grails gradle plugins (grails-plugin, grails-web, or grails-gsp). By default, the grails gradle plugins (grails-plugin, grails-web, grails-gsp) will apply the bom automatically.
- the gradle property `groovyVersion` is being replaced with the upstream spring property name `groovy.version`. Please update your projects accordingly.
- hibernate-ehcache
Expand All @@ -66,20 +46,8 @@ Experienced while upgrading modules for Grails 7

## NOTE: This document is a draft and the explanations are only highlights and will be expanded further prior to release of 7.0.

## New Features
- [grails-gsp #551](https://github.com/apache/grails-gsp/issues/551) adopts a `formActionSubmit` tag to replace `actionSubmit`. Dispatching actions via a parameter name on a form submit will be removed in a future version of grails.

### Cool New Features
- You can now @Scaffold Controllers and Services and virtually eliminate any boiler plate code.
- Hello Exterminator, Good by bugs! Lot's of things started working... and working well! For instance, use of controller namespaces now work seemlessly.
- Bootstrap 5.3.3 support. Saffolding and Fields tags now optionally support boostrap classes.
- Priortization of AutoConfiguration over bean overriding.
- Lightweight, Removal of numerous dependencies.
- grails-bom overhaul for keeping depedencies up to date and in sync.
- g:form now automatically provides csrf protection when Spring Security CSRF is enabled.
- Massive decoupling of dependencies and cleanup between modules. SiteMesh dependencies are no longer compiled into controllers fused between numerous modules. SiteMesh isn't even required to use Grails!
- SiteMesh ahs been upgrade to SiteMesh 3!
- Completely up to date modern stack that has been optimized for easier future transitions.
- GSP can now be used OUTSIDE of Grails! see grails-boot
- Works with Spring Security 6 out of the box. No plugin needed!
- Tested and works with Java 17-23 [grails-core](https://github.com/apache/grails-core/blob/7.0.x/.github/workflows/gradle.yml#L18)
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ ext {

allprojects {
repositories {
// workaround for https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/164
maven {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm starting to think we should ditch the Dependency Management Plugin, and only use Gradle Platforms.
We are actually adding the grails-bom as a platform in generated apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I 100% agree but we need the ability for end users to easily set versions. I am debating whats better: ditch the dependency plugin inside of grails core or keep it to align with what end user apps use. If gradle platforms supported property overrides, I would have suggested we already switch. I came close to writing a Gradle plugin to just add this support too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think property version overrides are a really good feature but when needed it can be accomplished with Gradle Platforms as well, only not as easily, as you have to declare the dependency you want to be able to override beforehand.
We should rip that band-aid, it causes confusion to do both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still maintain we shouldn't use both in end user apps - we should one or the other. The property overrides make it very easy to set versions. We should discuss this more outside of this PR.

name = 'localGrailsBom'
url = file("$rootDir/grails-bom/build/repo")
content { includeModule 'org.apache.grails', 'grails-bom' }
}
maven { url = 'https://repo.grails.org/grails/restricted' }
// mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow)
maven { url = 'https://repository.apache.org/content/groups/snapshots' }
Expand Down
27 changes: 12 additions & 15 deletions gradle/java-config.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://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.
* 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.
*/

compileJava.options.release = javaVersion.toInteger()
Expand Down Expand Up @@ -49,7 +47,6 @@ tasks.withType(Jar).configureEach {
'Implementation-Version': grailsVersion,
'Implementation-Vendor': 'grails.org'
)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// Any jar, zip, or archive should be reproducible
Expand Down
44 changes: 30 additions & 14 deletions grails-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://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.
* 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.grails.gradle.tasks.bom.ExtractDependenciesTask
Expand Down Expand Up @@ -161,4 +159,22 @@ ext {

apply {
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
}

// Workaround for https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/164
pluginManager.withPlugin('maven-publish') {
publishing {
repositories {
maven {
name = 'localBom'
url = layout.buildDirectory.dir('repo')
}
}
}

// project.afterEvaluate {
// tasks.named('assemble').configure {
// dependsOn tasks.named('publishMavenPublicationToLocalBomRepository')
// }
// }
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
/*
* 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
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://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.
* 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.
*/
package org.grails.plugins.codecs

import grails.plugins.Plugin
import grails.util.GrailsUtil
import org.grails.plugins.codecs.DefaultCodecLookup
import org.grails.commons.CodecArtefactHandler
import org.grails.encoder.impl.HTML4Codec
import org.grails.plugins.codecs.HTMLCodec
import org.grails.encoder.impl.HTMLJSCodec
import org.grails.encoder.impl.JavaScriptCodec
import org.grails.encoder.impl.RawCodec
import org.grails.plugins.codecs.URLCodec

/**
* Configures pluggable codecs.
Expand All @@ -48,4 +42,9 @@ class CodecsGrailsPlugin extends Plugin {
RawCodec
]

Closure doWithSpring() {
{ ->
codecLookup(DefaultCodecLookup)
}
}
}
3 changes: 0 additions & 3 deletions grails-codecs/src/main/resources/META-INF/grails-plugin.xml

This file was deleted.

This file was deleted.

This file was deleted.

47 changes: 18 additions & 29 deletions grails-core/src/main/groovy/grails/plugins/GrailsPlugin.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
/*
* 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
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
* https://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.
* 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.
*/
package grails.plugins;

import grails.core.GrailsApplication;
import grails.util.Environment;
import groovy.lang.GroovyObject;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import grails.core.GrailsApplication;
import org.grails.spring.RuntimeSpringConfiguration;
import org.grails.plugins.support.WatchPattern;
import org.grails.spring.RuntimeSpringConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.Resource;
import org.springframework.core.type.filter.TypeFilter;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
* <p>Plugin interface that adds Spring {@link org.springframework.beans.factory.config.BeanDefinition}s
* to a registry based on a {@link GrailsApplication} object. After all <code>GrailsPlugin</code> classes
Expand Down Expand Up @@ -214,14 +211,6 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail
*/
boolean supportsCurrentScopeAndEnvironment();

/**
* Write some documentation to the DocumentationContext
* @deprecated Dynamic document generation no longer supported
* @param text
*/
@Deprecated
void doc(String text);

/**
* Returns the path of the plug-in
*
Expand Down
Loading
Loading