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











up vote
0
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
























  • Just try separately mvn compile...
    – khmarbaise
    yesterday










  • Still doesn't work :(
    – Troskyvs
    yesterday










  • Ca you please create that project on github etc. so I can take a look...
    – khmarbaise
    yesterday






  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    yesterday






  • 2




    Glad you fixed it. Please post your solution as an answer since that is where readers will look for it, not in the question. You may also accept you own answer (after a period).
    – Ole V.V.
    yesterday















up vote
0
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
























  • Just try separately mvn compile...
    – khmarbaise
    yesterday










  • Still doesn't work :(
    – Troskyvs
    yesterday










  • Ca you please create that project on github etc. so I can take a look...
    – khmarbaise
    yesterday






  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    yesterday






  • 2




    Glad you fixed it. Please post your solution as an answer since that is where readers will look for it, not in the question. You may also accept you own answer (after a period).
    – Ole V.V.
    yesterday













up vote
0
down vote

favorite









up vote
0
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 yesterday

























asked yesterday









Troskyvs

2,132923




2,132923












  • Just try separately mvn compile...
    – khmarbaise
    yesterday










  • Still doesn't work :(
    – Troskyvs
    yesterday










  • Ca you please create that project on github etc. so I can take a look...
    – khmarbaise
    yesterday






  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    yesterday






  • 2




    Glad you fixed it. Please post your solution as an answer since that is where readers will look for it, not in the question. You may also accept you own answer (after a period).
    – Ole V.V.
    yesterday


















  • Just try separately mvn compile...
    – khmarbaise
    yesterday










  • Still doesn't work :(
    – Troskyvs
    yesterday










  • Ca you please create that project on github etc. so I can take a look...
    – khmarbaise
    yesterday






  • 1




    I got it, the <package> tag should be modified to "jar". Fixed!
    – Troskyvs
    yesterday






  • 2




    Glad you fixed it. Please post your solution as an answer since that is where readers will look for it, not in the question. You may also accept you own answer (after a period).
    – Ole V.V.
    yesterday
















Just try separately mvn compile...
– khmarbaise
yesterday




Just try separately mvn compile...
– khmarbaise
yesterday












Still doesn't work :(
– Troskyvs
yesterday




Still doesn't work :(
– Troskyvs
yesterday












Ca you please create that project on github etc. so I can take a look...
– khmarbaise
yesterday




Ca you please create that project on github etc. so I can take a look...
– khmarbaise
yesterday




1




1




I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
yesterday




I got it, the <package> tag should be modified to "jar". Fixed!
– Troskyvs
yesterday




2




2




Glad you fixed it. Please post your solution as an answer since that is where readers will look for it, not in the question. You may also accept you own answer (after a period).
– Ole V.V.
yesterday




Glad you fixed it. Please post your solution as an answer since that is where readers will look for it, not in the question. You may also accept you own answer (after a period).
– Ole V.V.
yesterday

















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





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


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




















































































Popular posts from this blog

The Sandy Post

Danny Elfman

Pages that link to "Head v. Amoskeag Manufacturing Co."