• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Class files are not being created

 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to get a very basic app compiled using Gradle and it's not working.
The build\classes directory is not being created.
I'm able to compile the Java files using javac and it runs as expected, so I don't think it's a Java issue.
I'm running this on a Windows 10 Pro system with only Java 9 installed.

I'm following this guide: https://spring.io/guides/gs/gradle/#scratch
I get to this point of the guide:

Guide wrote:The first time you run the wrapper for a specified version of Gradle, it downloads and caches the Gradle binaries for that version.
The Gradle Wrapper files are designed to be committed to source control so that anyone can build the project without having to first install and configure a specific version of Gradle.

At this stage, you will have built your code. You can see the results here:


The problem is that the class files are not created.
Here is my spring/build.gradle

Java file spring\src\main\hello\Greeter.java contents:

Java file spring\src\main\hello\HelloWorld.java contents:

Can you please tell me what I've done wrong and how I can fix it?
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fixed, I had the incorrect directory structure. Gradle needs to have the files in project_folder/src/main/java/package_name and I had them in project_folder/src/main/package_name.
 
Marshal
Posts: 6859
470
Mac OS X VI Editor BSD Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for coming back with your findings and solution.

And how is Gradle, you like it?

I just found on their website some upcoming training sessions (free), might want to note down some of those if free around that time.
https://gradle.org/training/
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do like Gradle, but maybe that's because that's all that I've use. I have not tried Maven and I don't plan to. Gradle was adopted by Android Studio, which is where I was introduced to it.

I do wonder why there is Ant, Maven, Gradle and others if they all do the same thing.

Thanks for the training link.
 
Liutauras Vilda
Marshal
Posts: 6859
470
Mac OS X VI Editor BSD Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pete Letkeman wrote:I do wonder why there is Ant, Maven, Gradle and others if they all do the same thing.


Probably similar as to why there are so many programming languages, with their own pros and cons.

To my knowledge, Gradle is by far most modern now and flexible among other build tools. Gradle uses Groovy implementation, making build script more concise. Ant and Maven are XML based.
On daily basis I'm using Maven and I believe it is still most widely used build tool as of now, with Ant I have very little experience.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!