Solved! Maven new project doesn't get java files build, why?









up vote
-1
down vote

favorite












[I got it, the tag should be modified to "jar". Fixed!]



I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8



(1) create a directory called mytest and enter:



mkdir mytest
cd mytest


(2) create folder structure of src/main/java



mkdir -p src/main/java


(3) create pom file:



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>


and a java file of "./src/main/java/m.java"



public class m
public static void main(String args)
System.out.println("hw");




(4) Now the structure is like:



.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml


(5) mvn clean compile:



$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------


From the screen print, no compilation is done. Check directory of "target", no class file generated.



Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?



Did I miss anything?










share|improve this question



















  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    Nov 10 at 10:06










  • Ah ..sorry you can simply omit the package tag ...the default is jar...
    – khmarbaise
    Nov 10 at 10:15














up vote
-1
down vote

favorite












[I got it, the tag should be modified to "jar". Fixed!]



I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8



(1) create a directory called mytest and enter:



mkdir mytest
cd mytest


(2) create folder structure of src/main/java



mkdir -p src/main/java


(3) create pom file:



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>


and a java file of "./src/main/java/m.java"



public class m
public static void main(String args)
System.out.println("hw");




(4) Now the structure is like:



.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml


(5) mvn clean compile:



$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------


From the screen print, no compilation is done. Check directory of "target", no class file generated.



Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?



Did I miss anything?










share|improve this question



















  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    Nov 10 at 10:06










  • Ah ..sorry you can simply omit the package tag ...the default is jar...
    – khmarbaise
    Nov 10 at 10:15












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











[I got it, the tag should be modified to "jar". Fixed!]



I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8



(1) create a directory called mytest and enter:



mkdir mytest
cd mytest


(2) create folder structure of src/main/java



mkdir -p src/main/java


(3) create pom file:



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>


and a java file of "./src/main/java/m.java"



public class m
public static void main(String args)
System.out.println("hw");




(4) Now the structure is like:



.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml


(5) mvn clean compile:



$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------


From the screen print, no compilation is done. Check directory of "target", no class file generated.



Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?



Did I miss anything?










share|improve this question















[I got it, the tag should be modified to "jar". Fixed!]



I've tried this on both ubuntu and mac, doesn't work. I've Apache Maven 3.5.2 and jdk 1.8



(1) create a directory called mytest and enter:



mkdir mytest
cd mytest


(2) create folder structure of src/main/java



mkdir -p src/main/java


(3) create pom file:



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.mytest</groupId>
<artifactId>mytest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
</project>


and a java file of "./src/main/java/m.java"



public class m
public static void main(String args)
System.out.println("hw");




(4) Now the structure is like:



.
./src
./src/main
./src/main/java
./src/main/java/m.java
./pom.xml


(5) mvn clean compile:



$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mytest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.271 s
[INFO] Finished at: 2018-11-10T01:19:27-08:00
[INFO] Final Memory: 7M/188M
[INFO] ------------------------------------------------------------------------


From the screen print, no compilation is done. Check directory of "target", no class file generated.



Why this? I hope that when I have standard folder structure of src/main/java, then maven should automatically try to find the .java file and compile it into target/ folder right?



Did I miss anything?







java maven compilation pom.xml target






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 10:07

























asked Nov 10 at 9:22









Troskyvs

2,23111026




2,23111026







  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    Nov 10 at 10:06










  • Ah ..sorry you can simply omit the package tag ...the default is jar...
    – khmarbaise
    Nov 10 at 10:15












  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    Nov 10 at 10:06










  • Ah ..sorry you can simply omit the package tag ...the default is jar...
    – khmarbaise
    Nov 10 at 10:15







1




1




I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06




I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
Nov 10 at 10:06












Ah ..sorry you can simply omit the package tag ...the default is jar...
– khmarbaise
Nov 10 at 10:15




Ah ..sorry you can simply omit the package tag ...the default is jar...
– khmarbaise
Nov 10 at 10:15

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237582%2fsolved-maven-new-project-doesnt-get-java-files-build-why%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237582%2fsolved-maven-new-project-doesnt-get-java-files-build-why%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo