Gradle init not generate build.gradle

gradle-3438
issue-acknowledged

(Sérgio Michels) #1

Just installed STS Gradle plugin in Mars and tried to create a new project based on a Maven project. Gradle init runs without errors, but only creates this structure

my-project
gradle
wrapper
gradle-wrapper.jar
gradle-wrapper.properties
gradlew
gradlew.bat
pom.xml
src

In my understanding it should parse the pom.xml and create the build.gradle, correct? Here’s my pom

<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<groupId>group.id</groupId>
	<version>1.1.0</version>
	
	<artifactId>my-project</artifactId>

	<build>
		<plugins>
			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>

				<configuration>
					<encoding>UTF-8</encoding>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>

			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.6</version>

				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.2.1</version>

				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>

				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.jvnet.jax-ws-commons</groupId>
				<artifactId>jaxws-maven-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<id>cdm</id>
						<goals>
							<goal>wsimport</goal>
						</goals>
						<phase>${wsimport-phase}</phase>
						<configuration>
							<sourceDestDir>src/main/java</sourceDestDir>
							<verbose>true</verbose>
							<xnoAddressingDataBinding>true</xnoAddressingDataBinding>
							<xnocompile>true</xnocompile>
							<target>2.1</target>
							<wsdlUrls>
								<wsdlUrl>${osb.url.prefix}MyService${osb.url.suffix}</wsdlUrl>
							</wsdlUrls>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	
	<profiles>
		<profile>
			<id>via-osb</id>
			<properties>
				<wsimport-phase>generate-sources</wsimport-phase>
				<skip-clean>false</skip-clean>
				<osb.protocol>http</osb.protocol>
				<osb.host>my.host</osb.host>
				<osb.port>80</osb.port>
				<osb.url.prefix>${osb.protocol}://${osb.host}:${osb.port}/path/to/osb/</osb.url.prefix>
		  		<osb.url.suffix>v102?wsdl</osb.url.suffix>
			</properties>
		</profile>			
	</profiles>	

</project>

Am I missing something? Can I debug this flow?


(René Groeschke) #2

that is surprising behaviour. How have you invoked the Gradle init task? via commandline or via Eclipse STS? can you try from commandline if you havn’t yet?


(René Groeschke) #3

I think I’ve found the problem and raised GRADLE-3438 for this and the fix will be in Gradle 2.14. The problem is that the workingdirectoy in STS does not match the root of the maven project. Running the gradle init task from the commandline should do the job for you.

cheers,
rene


(Sérgio Michels) #4

Thanks René, from the command line it worked :slight_smile:

Unfortunately the tool seems too simple for me, it just created the build.gradle with some dependencies, not resolving maven plugins.