Works fine
This commit is contained in:
@@ -42,6 +42,16 @@
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.springframework.cloud.release;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.release.internal.ProjectUpdater;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ReleaserApplication implements CommandLineRunner {
|
||||
|
||||
private static final Logger log = getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ReleaserApplication.class, args);
|
||||
}
|
||||
|
||||
@Autowired ProjectUpdater projectUpdater;
|
||||
|
||||
@Override public void run(String... strings) throws Exception {
|
||||
String workingDir = System.getProperty("user.dir");
|
||||
log.info("Will run the application for root folder [{}]", workingDir);
|
||||
log.info("Press any key to continue...");
|
||||
System.in.read();
|
||||
this.projectUpdater.updateProject(new File(workingDir));
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,10 @@ class PomUpdater {
|
||||
return changes;
|
||||
}
|
||||
}
|
||||
if (oldVersion.equals(version)) {
|
||||
log.info("Won't update the version of [{}]:[{}] since you're already using the proper one", parentGroupId, parentArtifactId);
|
||||
return changes;
|
||||
}
|
||||
log.info("Setting version of parent [{}] to [{}] for module [{}]", parentArtifactId,
|
||||
version, model.getArtifactId());
|
||||
changes.add(new VersionChange(parentGroupId, parentArtifactId, oldVersion, version));
|
||||
@@ -131,16 +135,20 @@ class PomUpdater {
|
||||
Model model, List<VersionChange> sourceChanges) {
|
||||
String rootProjectName = wrapper.projectName();
|
||||
List<VersionChange> changes = new ArrayList<>(sourceChanges);
|
||||
String parentGroupId = groupId(model);
|
||||
String parentArtifactId = model.getArtifactId();
|
||||
String groupId = groupId(model);
|
||||
String artifactId = model.getArtifactId();
|
||||
String oldVersion = model.getVersion();
|
||||
String version = versions.versionForProject(rootProjectName);
|
||||
if (StringUtils.isEmpty(version) || StringUtils.isEmpty(model.getVersion())) {
|
||||
log.warn("There was no version set for project [{}], skipping version setting for module [{}]", rootProjectName, model.getArtifactId());
|
||||
return changes;
|
||||
}
|
||||
log.info("Setting [{}] version to [{}]", model.getArtifactId(), version);
|
||||
changes.add(new VersionChange(parentGroupId, parentArtifactId, oldVersion, version));
|
||||
if (oldVersion.equals(version)) {
|
||||
log.info("Won't update the version of [{}]:[{}] since you're already using the proper one", groupId, artifactId);
|
||||
return changes;
|
||||
}
|
||||
log.info("Setting [{}] version to [{}]", artifactId, version);
|
||||
changes.add(new VersionChange(groupId, artifactId, oldVersion, version));
|
||||
return changes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package org.springframework.cloud.release.spring;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.release.internal.ProjectUpdater;
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(ReleaserProperties.class)
|
||||
class ReleaserConfiguration {
|
||||
|
||||
@Bean ProjectUpdater projectUpdater(ReleaserProperties properties) {
|
||||
return new ProjectUpdater(properties);
|
||||
}
|
||||
}
|
||||
@@ -23,14 +23,6 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>releaser-core</artifactId>
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.cloud.release;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
@@ -27,6 +25,8 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.release.internal.ProjectUpdater;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ReleaserApplication implements CommandLineRunner {
|
||||
|
||||
@@ -44,5 +44,6 @@ public class ReleaserApplication implements CommandLineRunner {
|
||||
log.info("Press any key to continue...");
|
||||
System.in.read();
|
||||
this.projectUpdater.updateProject(new File(workingDir));
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user