Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code update to Maven file structure #39

Open
mgeorgiades opened this issue Aug 12, 2023 · 3 comments
Open

code update to Maven file structure #39

mgeorgiades opened this issue Aug 12, 2023 · 3 comments

Comments

@mgeorgiades
Copy link

mgeorgiades commented Aug 12, 2023

hi Mechalikh,

thank you for your code. I used to have a running code in the past with a previous version!

I tried to use the latest version of the PureEdgeSim code and update the structure to one preferred by Maven and used the latest Java in Ubuntu 23.04.
(base) mike@mike-HP-ProBook-430-G5:~/.m2$ java --version
openjdk 18.0.2-ea 2022-07-19
OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-2ubuntu1)
OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-2ubuntu1, mixed mode, sharing)

but I get issues.

Is it possible to update the structure to one preferred by Maven compilation and test with latest Java version in Ubuntu/Linux?

my-project/
├── src/
│ ├── main/
│ │ ├── java/ <-- Your Java source code goes here
│ │ │ └── com/
│ │ │ └── mechalikh/
│ │ │ └── pureedgesim/
│ │ │ └── MainApplication.java
│ │ └── resources/ <-- Resources (like properties files) go here
│ │ └── application.properties
│ └── test/
│ ├── java/ <-- Test source code goes here
│ │ └── com/
│ │ └── mechalikh/
│ │ └── pureedgesim/
│ │ └── MainApplicationTest.java
│ └── resources/ <-- Test resources go here
│ └── test-data.json
└── pom.xml <-- Project configuration file

Kind regards,
Mihalis

@mgeorgiades
Copy link
Author

mgeorgiades commented Aug 13, 2023

OK. I fixed it with the latest Java, Maven and Ubuntu. I have duplicate folders but at least it works.

Description: Ubuntu 23.04
openjdk 18.0.2-ea 2022-07-19
OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-2ubuntu1)
OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-2ubuntu1, mixed mode, sharing)
Apache Maven 3.8.7

@mgeorgiades
Copy link
Author

mgeorgiades commented Aug 13, 2023

I cleaned it. I am not an expert programmer, but I moved only the necessary folders as desired by Maven and got the below new tree structure.

├── bin
│   ├── CHANGELOG.md
│   ├── CNAME
│   ├── _config.yml
│   ├── jacoco.xml
│   ├── LICENSE
│   ├── pom.xml
│   ├── PureEdgeSim
│   ├── README.md
│   └── target
├── CHANGELOG.md
├── CNAME
├── _config.yml
├── jacoco.xml
├── LICENSE
├── pom.xml
├── PureEdgeSim
│   ├── output
│   └── settings
├── PureEdgeSim.tar.gz
├── README.md
├── src
│   └── main
└── target
├── classes
├── maven-archiver
├── maven-status
├── pureedgesim-5.2.0.jar
└── pureedgesim-5.2.0-sources.jar

@mgeorgiades
Copy link
Author

and changed pom.xml to the below. of course /home/mike should be replaced with your name or folders.

4.0.0 com.mechalikh pureedgesim 5.2.0 PureEdgeSim https://github.com/CharafeddineMechalikh/PureEdgeSim A simualtor for edge computing environments
<organization>
	<name>LIPAH laboratory, Faculty of Science of Tunis</name>
	<url>http://www.fst.rnu.tn</url>
</organization>

<licenses>
	<license>
		<name>GPLv3</name>
		<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
	</license>
</licenses>

<developers>
	<developer>
		<name>Charafeddine Mechalikh</name>
		<email>[email protected]</email>
		<organization>LIPAH laboratory, Faculty of Science of Tunis</organization>
		<organizationUrl>http://www.fst.rnu.tn</organizationUrl>
	</developer>
</developers>

<scm>
	<connection>scm:git:[email protected]:CharafeddineMechalikh/PureEdgeSim.git</connection>
	<developerConnection>scm:git:[email protected]:CharafeddineMechalikh/PureEdgeSim.git</developerConnection>
	<url>https://github.com/CharafeddineMechalikh/PureEdgeSim</url>
</scm>

<issueManagement>
	<url>https://github.com/CharafeddineMechalikh/PureEdgeSim/issues</url>
	<system>GitHub Issues</system>
</issueManagement>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<license.dir>/home/mike/Simulations/PureEdgeSim-master/LICENSE</license.dir>
	<license-maven-plugin.version>3.0</license-maven-plugin.version>
	<!-- License file to be used by the com.mycila.license-maven-plugin -->
	<copyrightfile>COPYRIGHT</copyrightfile>
	<maven.compiler.target>1.8</maven.compiler.target>
	<maven.compiler.source>1.8</maven.compiler.source>
	<maven.compiler.release>11</maven.compiler.release>
</properties>

<repositories>
    <repository>
        <id>com.springsource.repository.bundles.release</id>
        <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
        <url>http://repository.springsource.com/maven/bundles/release</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.external</id>
        <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
        <url>http://repository.springsource.com/maven/bundles/external</url>
    </repository>
</repositories>

<profiles>
	<!-- The profiles 'default' and 'integration-tests' are specified to allow 
		using the maven-surefire-plugin instead of the maven-failsafe-plugin to run 
		Integration/Functional tests. By this way, it is possible to see the Integration/Functional 
		tests results directly at the NetBeans JUnit graphical test results interface. -->
	<profile>
		<!-- This is the default profile that runs just the Unit Tests, ignoring 
			the Integration/Functional tests. -->
		<id>default</id>
		<activation>
			<activeByDefault>true</activeByDefault>
		</activation>
		<build>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<configuration>
						<excludes>
							<exclude>**/integrationtests/*.java</exclude>
						</excludes>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.2.1</version>
					<executions>
						<execution>
							<id>attach-sources</id>
							<goals>
								<goal>jar-no-fork</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>3.2.0</version>
					<configuration>
						<source>8</source>
					</configuration>
				</plugin>
			</plugins>
		</build>
	</profile>

	<profile>
		<!-- This is the profile that runs all the Unit and Integration/Functional 
			Tests. -->
		<id>integration-tests</id>
		<build>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
				</plugin>
			</plugins>
		</build>
	</profile>

	<profile>
		<!-- A profile used to execute all goals required to deploy the project 
			to the Maven Central. To execute use: mvn clean deploy -P sonatype To check 
			the deployed artifact and probably release it to maven central you should 
			visit https://oss.sonatype.org. MAKE SURE YOU ARE LOGGED IN TO SEE YOUR DEPLOYMENTS. -->
		<id>sonatype</id>

		<!-- URLs to deploy the project at the Maven Central (http://mvnrepository.com) 
			using a Sonatype account (http://central.sonatype.org) See the "all" profile 
			in this pom for deployment information. -->
		<!-- repository for uploading -->
		<distributionManagement>
			<snapshotRepository>
				<id>ossrh</id>
				<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
			</snapshotRepository>
			<repository>
				<id>ossrh</id>
				<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
			</repository>
		</distributionManagement>

		<build>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.2.1</version>
					<executions>
						<execution>
							<id>attach-sources</id>
							<phase>verify</phase>
							<goals>
								<goal>jar-no-fork</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<configuration>
						<excludePackageNames>examples</excludePackageNames>
					</configuration>
					<executions>
						<execution>
							<id>attach-javadocs</id>
							<goals>
								<goal>jar</goal>
							</goals>
							<configuration>
    							<release>11</release>
  							</configuration>
						</execution>
					</executions>
				</plugin>

				<!-- Signs the generated jar using GPG, as required for deploying at 
					the Maven Central. Configurations are defined into the local repo settings.xml -->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>1.6</version>
					<executions>
						<execution>
							<id>sign-artifacts</id>
							<phase>verify</phase>
							<goals>
								<goal>sign</goal>
							</goals>
							<configuration>
								<keyname>08CC1595464BBEC0</keyname>
								<passphraseServerId>mihalis</passphraseServerId>
							</configuration>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</build>
	</profile>
</profiles>

<build>
	<pluginManagement>
		<!-- Plugins to be reused for different <profile>'s -->
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<!-- There is some problem with the version 2.19.1 or with Netbeans 
					8.0.2 that the JUnit GUI is not shown at the IDE -->
				<version>3.0.0-M5</version>
				<configuration>
					<forkCount>1</forkCount>
					<reuseForks>false</reuseForks>
					<testFailureIgnore>true</testFailureIgnore>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>3.1.0</version>
				<configuration>
					<failOnError>false</failOnError>
					<tags>
						<tag>
							<name>TODO</name>
							<!-- TODO tag for all places -->
							<placement>a</placement>
							<head>To do something:</head>
						</tag>
					</tags>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>

	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-jar-plugin</artifactId>
			<version>3.2.0</version>
			<configuration>
				<archive>
					<manifest>
						<!-- Adds dependencies to classpath into the manifest file inside 
							the jar ! -->
						<addClasspath>true</addClasspath>

						<!-- Defines that the dependencies will follow the same hierarchical 
							directory structure of a maven repository ! -->
						<classpathLayoutType>repository</classpathLayoutType>

						<!-- Defines the root folder where the dependencies are. In this case 
							is the the root of the local maven repository. ! -->
						<classpathPrefix>/home/mike/.m2/repository/</classpathPrefix>
					</manifest>
				</archive>
			</configuration>
		</plugin>

		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.8.1</version>
			<configuration>
				<generatedSourcesDirectory>src/main/java</generatedSourcesDirectory>
				<excludes>
					<exclude>**/examples/Example8.java</exclude>
					<exclude>**/examples/Example8FuzzyLogicOrchestrator.java</exclude>
					<exclude>**/examples/Example1.java</exclude>
					<exclude>**/examples/Example5.java</exclude>
				</excludes>
				<release>11</release>
			</configuration>
		</plugin>

		<!-- Plugin for code coverage, enabling generation of reports on IDE to 
			see percentage of the project's code that is being covered by unit tests. -->
		<plugin>
			<groupId>org.jacoco</groupId>
			<artifactId>jacoco-maven-plugin</artifactId>
			<version>0.8.7</version>
			<configuration>
				<excludes>
					<exclude>**/libs/</exclude>
					<exclude>**/examples/</exclude>
				</excludes>
			</configuration>
			<executions>
				<execution>
					<id>prepare-agent</id>
					<goals>
						<goal>prepare-agent</goal>
					</goals>
				</execution>
				<execution>
					<id>report</id>
					<phase>test</phase>
					<goals>
						<goal>report</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

<reporting>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-javadoc-plugin</artifactId>
			<version>3.1.0</version>
			<reportSets>
				<!-- https://maven.apache.org/plugins/maven-javadoc-plugin/examples/javadoc-nofork.html -->
				<reportSet>
					<reports>
						<report>javadoc-no-fork</report>
						<report>test-javadoc-no-fork</report>
					</reports>
				</reportSet>
			</reportSets>

			<configuration>
				<tags>
					<tag>
						<name>TODO</name>
						<!-- TODO tag for all places -->
						<placement>a</placement>
						<head>To do something:</head>
					</tag>
				</tags>
			</configuration>
		</plugin>
	</plugins>
</reporting>


<dependencies>
	<dependency>
		<groupId>org.jgrapht</groupId>
		<artifactId>jgrapht-core</artifactId>
		<version>1.3.1</version>
	</dependency>
	<dependency>
		<groupId>org.knowm.xchart</groupId>
		<artifactId>xchart</artifactId>
		<version>3.8.0</version>
	</dependency>
	<dependency>
		<groupId>org.junit.jupiter</groupId>
		<artifactId>junit-jupiter-engine</artifactId>
		<version>5.8.2</version>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>de.biomedical-imaging.edu.wlu.cs.levy.cg</groupId>
		<artifactId>kdtree</artifactId>
		<version>1.0.3</version>
	</dependency>
	<dependency>
		<groupId>org.mockito</groupId>
		<artifactId>mockito-core</artifactId>
		<version>4.0.0</version>
		<scope>test</scope>
	</dependency>
	<!--
	<dependency>
		<groupId>net.sourceforge.jFuzzyLogic</groupId>
		<artifactId>jFuzzyLogic</artifactId>
		<version>3.0</version>
		<scope>system</scope>
		<systemPath>${project.basedir}/PureEdgeSim/libs/jFuzzyLogic_v3.0.jar</systemPath>
	</dependency>
	-->
</dependencies>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant