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?
java maven compilation pom.xml target
|
show 1 more comment
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?
java maven compilation pom.xml target
Just try separatelymvn 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
|
show 1 more comment
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?
java maven compilation pom.xml target
[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
java maven compilation pom.xml target
edited yesterday
asked yesterday
Troskyvs
2,132923
2,132923
Just try separatelymvn 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
|
show 1 more comment
Just try separatelymvn 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
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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